| 1 |
// https://issues.dlang.org/show_bug.cgi?id=2450 |
| 2 |
/* |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
fail_compilation/fail2450.d(20): Error: function expected before `()`, not `this.mixin Event!() clicked;` of type `void` |
| 6 |
fail_compilation/fail2450.d(23): Error: function expected before `()`, not `b.mixin Event!() clicked;` of type `void` |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
template Event() |
| 11 |
{ |
| 12 |
void opCall() { } |
| 13 |
void opAddAssign(int i) { } |
| 14 |
} |
| 15 |
class Button { |
| 16 |
mixin Event clicked; |
| 17 |
void func() |
| 18 |
{ |
| 19 |
clicked.opCall(); // works |
| 20 |
this.clicked(); // works |
| 21 |
|
| 22 |
auto b = new Button(); |
| 23 |
b.clicked(); // works |
| 24 |
} |
| 25 |
} |