]> git.ipfire.org Git - people/ms/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/test20719.d
d: Merge upstream dmd, druntime 4ca4140e58, phobos 454dff14d.
[people/ms/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test20719.d
1 /* TEST_OUTPUT:
2 ---
3 fail_compilation/test20719.d(13): Error: struct `test20719.SumType` no size because of forward reference
4 fail_compilation/test20719.d(32): Error: variable `test20719.isCopyable!(SumType).__lambda2.foo` - size of type `SumType` is invalid
5 fail_compilation/test20719.d(18): Error: template instance `test20719.isCopyable!(SumType)` error instantiating
6 ---
7 */
8 struct SumType
9 {
10 alias Types = AliasSeq!(typeof(this));
11 union Storage
12 {
13 Types[0] t;
14 }
15
16 Storage storage;
17
18 static if (isCopyable!(Types[0])) {}
19 static if (isAssignable!(Types[0])) {}
20 }
21
22 alias AliasSeq(TList...) = TList;
23
24 enum isAssignable(Rhs) = __traits(compiles, lvalueOf = rvalueOf!Rhs);
25
26 struct __InoutWorkaroundStruct {}
27
28 T rvalueOf(T)();
29
30 T lvalueOf()(__InoutWorkaroundStruct);
31
32 enum isCopyable(S) = { S foo; };