aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/fail346.d
blob: 77042cc111bec33a4c3e687fa89b639e747a9968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
TEST_OUTPUT:
---
fail_compilation/fail346.d(15): Error: undefined identifier `P`
fail_compilation/fail346.d(15): Error: variable `fail346.S.T!0.T` cannot use template to add field to aggregate `S`
fail_compilation/fail346.d(20): Error: template instance `fail346.S.T!0` error instantiating
fail_compilation/fail346.d(23):        instantiated from here: `V!(S, 0)`
---
*/

struct S {
    int x;

    template T(int val) {
        const P T = { val }; // the P here is an error it should be S
    }
}

template V(R,int val){
    const R V=R.T!(val);
}

const S x = V!(S,0);