| 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 |
--- |
| 11 |
*/ |
| 12 |
|
| 13 |
template Pred(A, B) |
| 14 |
{ |
| 15 |
static if(is(B == int)) |
| 16 |
enum bool Pred = true; |
| 17 |
else |
| 18 |
enum bool Pred = false; |
| 19 |
} |
| 20 |
|
| 21 |
template PredAny(A, B...) |
| 22 |
{ |
| 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..$]); |
| 27 |
} |
| 28 |
|
| 29 |
void main() |
| 30 |
{ |
| 31 |
pragma(msg, PredAny!(int, long, float)); |
| 32 |
} |