forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatics.C
More file actions
41 lines (34 loc) · 1022 Bytes
/
Statics.C
File metadata and controls
41 lines (34 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
#include <stdio.h>
struct TERD {
const char *Name;
TERD(const char *N) : Name(N) { printf("TERD::TERD::%s\n", Name); }
~TERD() { printf("TERD::~TERD::%s\n", Name); }
};
static TERD& inst01() {
static TERD st01("inst01");
return st01;
}
static TERD& inst02() {
static TERD st02("inst02");
return st02;
}
inst01();
inst01();
inst01();
// CHECK: TERD::TERD::inst01
inst02();
inst02();
inst02();
// CHECK-NEXT: TERD::TERD::inst02
// expected-no-diagnostics
.q
// CHECK: TERD::~TERD::inst02
// CHECK-NEXT: TERD::~TERD::inst01