blob: 97dbeb6190b80da608ce80ab9cf7369c6aa7278f (
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
|
// PR c++/15172
// { dg-do run }
extern "C" int printf (const char *, ...);
extern "C" void abort ();
struct A {
static A* p;
A() { p = this; }
A(const A&);
~A() { if (this != p) abort (); }
void print () { }
};
A* A::p;
struct B {
A a;
};
B b = { A () };
struct A2 {
static A2* p;
A2() { p = this; }
A2(const A2&);
~A2() { if (this != p) abort (); }
void print () { }
};
A2* A2::p;
struct B2 {
A2 a2;
};
int main () {
b.a.print ();
{
B2 b2 = { A2() };
b2.a2.print ();
}
}
|