d: Merge dmd, druntime d8e3976a58, phobos 7a6e95688
[official-gcc.git] / gcc / testsuite / gdc.test / runnable_cxx / test24292.d
blobb71f925639c6087e084e55f377ee7700b34f38a4
1 // EXTRA_CPP_SOURCES: test24292.cpp
3 extern(C++) struct List(T)
5 // Any of the following static ifs can trigger the problem.
6 static if (T.sizeof > 4) {}
7 static if (__traits(isZeroInit, T)) {}
8 static if (__traits(isPOD, T)) {}
10 T* begin;
13 extern(C++) struct StructWithDestructor
15 ~this();
17 alias L = List!StructWithDestructor;
18 int i;
21 extern(C++) struct StructWithCopyCtor
23 this(ref const(StructWithCopyCtor));
25 alias L = List!StructWithCopyCtor;
26 int i;
29 extern(D) struct StructWithPostblit
31 this(this) {}
33 alias L = List!StructWithPostblit;
34 int i;
37 static assert(!__traits(isPOD, StructWithDestructor));
38 static assert(!__traits(isPOD, StructWithCopyCtor));
39 static assert(!__traits(isPOD, StructWithPostblit));
41 extern(C++) StructWithDestructor getStructWithDestructor();
42 extern(C++) StructWithCopyCtor getStructWithCopyCtor();
44 void main()
46 StructWithDestructor structWithDestructor = getStructWithDestructor();
47 assert(structWithDestructor.i == 12345);
48 StructWithCopyCtor structWithCopyCtor = getStructWithCopyCtor();
49 assert(structWithCopyCtor.i == 54321);