c++: Fix crash during NRV optimization with invalid input [PR117099, PR117129]
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail6968.d
blobaca90c6c3dd0c72c00e06fa0a441bbd0944d9eb9
1 // https://issues.dlang.org/show_bug.cgi?id=6968
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail6968.d(26): Error: cannot pass type `int` as a function argument
6 fail_compilation/fail6968.d(26): Error: cannot pass type `long` as a function argument
7 fail_compilation/fail6968.d(26): Error: circular initialization of variable `fail6968.PredAny!(int, long, float).PredAny`
8 fail_compilation/fail6968.d(31): Error: template instance `fail6968.PredAny!(int, long, float)` error instantiating
9 fail_compilation/fail6968.d(31): while evaluating `pragma(msg, PredAny!(int, long, float))`
10 ---
13 template Pred(A, B)
15 static if(is(B == int))
16 enum bool Pred = true;
17 else
18 enum bool Pred = false;
21 template PredAny(A, B...)
23 static if(B.length == 0)
24 enum bool PredAny = false;
25 else
26 enum bool PredAny = Pred(A, B[0]) || PredAny(A, B[1..$]);
29 void main()
31 pragma(msg, PredAny!(int, long, float));