| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
A: false |
| 5 |
A: false |
| 6 |
fail_compilation/fail7862.d(26): Error: template instance `nonExistent!()` template `nonExistent` is not defined |
| 7 |
fail_compilation/fail7862.d(25): Error: template instance `fail7862.B!(A)` error instantiating |
| 8 |
--- |
| 9 |
*/ |
| 10 |
|
| 11 |
// https://issues.dlang.org/show_bug.cgi?id=7862 |
| 12 |
|
| 13 |
template B(T) { |
| 14 |
mixin( |
| 15 |
{ |
| 16 |
foreach (name; __traits(derivedMembers, T)) {} |
| 17 |
return "struct B {}"; |
| 18 |
}() |
| 19 |
); |
| 20 |
} |
| 21 |
|
| 22 |
struct A { |
| 23 |
pragma(msg, "A: " ~ (__traits(compiles, B!A) ? "true" : "false")); |
| 24 |
pragma(msg, "A: " ~ (__traits(compiles, B!A) ? "true" : "false")); |
| 25 |
B!A c; |
| 26 |
static if (nonExistent!()) {} |
| 27 |
} |
| 28 |
|
| 29 |
auto d = A.init.c; |