| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail18970.d(26): Error: no property `y` for `S()` of type `fail18970.S` |
| 5 |
fail_compilation/fail18970.d(19): Error: undefined identifier `x` |
| 6 |
fail_compilation/fail18970.d(26): Error: template instance `fail18970.S.opDispatch!"y"` error instantiating |
| 7 |
fail_compilation/fail18970.d(33): Error: no property `yyy` for `this` of type `fail18970.S2` |
| 8 |
fail_compilation/fail18970.d(38): Error: undefined identifier `x` |
| 9 |
fail_compilation/fail18970.d(33): Error: template instance `fail18970.S2.opDispatch!"yyy"` error instantiating |
| 10 |
--- |
| 11 |
*/ |
| 12 |
|
| 13 |
// https://issues.dlang.org/show_bug.cgi?id=18970 |
| 14 |
|
| 15 |
struct S |
| 16 |
{ |
| 17 |
auto opDispatch(string name)(int) |
| 18 |
{ |
| 19 |
alias T = typeof(x); |
| 20 |
static assert(!is(T.U)); |
| 21 |
return 0; |
| 22 |
} |
| 23 |
} |
| 24 |
void f() |
| 25 |
{ |
| 26 |
S().y(1); |
| 27 |
} |
| 28 |
|
| 29 |
struct S2 |
| 30 |
{ |
| 31 |
this(int) |
| 32 |
{ |
| 33 |
this.yyy; |
| 34 |
} |
| 35 |
|
| 36 |
auto opDispatch(string name)() |
| 37 |
{ |
| 38 |
alias T = typeof(x); |
| 39 |
static if(is(T.U)) {} |
| 40 |
} |
| 41 |
} |