| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/ice13356.d(32): Error: template instance `Algebraic!(Tuple!(List))` recursive template expansion |
| 5 |
fail_compilation/ice13356.d(15): Error: template instance `ice13356.isPrintable!(List)` error instantiating |
| 6 |
fail_compilation/ice13356.d(33): instantiated from here: `Tuple!(List)` |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
struct Tuple(Types...) |
| 11 |
{ |
| 12 |
Types expand; |
| 13 |
alias expand this; |
| 14 |
|
| 15 |
static if (isPrintable!(Types[0])) |
| 16 |
{ |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
// T == Tuple!List, and accessing its .init will cause unresolved forward reference |
| 21 |
enum bool isPrintable(T) = is(typeof({ T t; })); |
| 22 |
|
| 23 |
struct Algebraic(AllowedTypesX...) |
| 24 |
{ |
| 25 |
alias AllowedTypes = AllowedTypesX; |
| 26 |
|
| 27 |
double x; // dummy for the syntax Payload(d) |
| 28 |
} |
| 29 |
|
| 30 |
struct List |
| 31 |
{ |
| 32 |
alias Payload = Algebraic!( |
| 33 |
Tuple!(List) |
| 34 |
); |
| 35 |
|
| 36 |
Payload payload; |
| 37 |
|
| 38 |
this(double d) { payload = Payload(d); } |
| 39 |
} |
| 40 |
|
| 41 |
void main() {} |