| 1 |
/* TEST_OUTPUT: |
| 2 |
--- |
| 3 |
fail_compilation/test20719.d(14): Error: struct `test20719.SumType` no size because of forward reference |
| 4 |
fail_compilation/test20719.d(17): error on member `test20719.SumType.storage` |
| 5 |
fail_compilation/test20719.d(33): Error: variable `test20719.isCopyable!(SumType).__lambda_L33_C22.foo` - size of type `SumType` is invalid |
| 6 |
fail_compilation/test20719.d(19): Error: template instance `test20719.isCopyable!(SumType)` error instantiating |
| 7 |
--- |
| 8 |
*/ |
| 9 |
struct SumType |
| 10 |
{ |
| 11 |
alias Types = AliasSeq!(typeof(this)); |
| 12 |
union Storage |
| 13 |
{ |
| 14 |
Types[0] t; |
| 15 |
} |
| 16 |
|
| 17 |
Storage storage; |
| 18 |
|
| 19 |
static if (isCopyable!(Types[0])) {} |
| 20 |
static if (isAssignable!(Types[0])) {} |
| 21 |
} |
| 22 |
|
| 23 |
alias AliasSeq(TList...) = TList; |
| 24 |
|
| 25 |
enum isAssignable(Rhs) = __traits(compiles, lvalueOf = rvalueOf!Rhs); |
| 26 |
|
| 27 |
struct __InoutWorkaroundStruct {} |
| 28 |
|
| 29 |
T rvalueOf(T)(); |
| 30 |
|
| 31 |
T lvalueOf()(__InoutWorkaroundStruct); |
| 32 |
|
| 33 |
enum isCopyable(S) = { S foo; }; |