| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail346.d(15): Error: undefined identifier `P` |
| 5 |
fail_compilation/fail346.d(15): Error: variable `fail346.S.T!0.T` - cannot use template to add field to aggregate `S` |
| 6 |
fail_compilation/fail346.d(20): Error: template instance `fail346.S.T!0` error instantiating |
| 7 |
fail_compilation/fail346.d(23): instantiated from here: `V!(S, 0)` |
| 8 |
--- |
| 9 |
*/ |
| 10 |
|
| 11 |
struct S { |
| 12 |
int x; |
| 13 |
|
| 14 |
template T(int val) { |
| 15 |
const P T = { val }; // the P here is an error it should be S |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
template V(R,int val){ |
| 20 |
const R V=R.T!(val); |
| 21 |
} |
| 22 |
|
| 23 |
const S x = V!(S,0); |