aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/lib_min.cpp
blob: 1662bfc46722c98c3153e6a16b174f3df98e9bbd (plain)
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
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>

static const struct XXX {
	XXX() { puts("XXX"); }
} s_sss;

struct A {
	int aaa;
	A()
		: aaa(123)
	{
		puts("A cstr");
	}
	~A()
	{
		puts("A dstr");
	}
	void put() const
	{
		printf("aaa=%d\n", aaa);
	}
};

template<int dummy = 0>
struct XT {
	static A sss;
};

template<int dummy>
A XT<dummy>::sss;

typedef XT<0> X;

static struct Init {
	Init()
	{
		puts("Init");
		X::sss.put();
	}
} s_init;

int f() { puts("f"); return 4; }

static const int r = f();

int main()
{
	puts("main");
	printf("r=%d\n", r);
	X::sss.put();
}