| 1 |
// https://issues.dlang.org/show_bug.cgi?id=21802 |
| 2 |
|
| 3 |
struct A |
| 4 |
{ |
| 5 |
auto opAssign(lazy void foo) |
| 6 |
{ |
| 7 |
foo(); |
| 8 |
} |
| 9 |
auto opOpAssign(string op)(lazy void foo) |
| 10 |
{ |
| 11 |
foo(); |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
class C |
| 16 |
{ |
| 17 |
auto opAssign(lazy void foo) |
| 18 |
{ |
| 19 |
foo(); |
| 20 |
} |
| 21 |
auto opOpAssign(string op)(lazy void foo) |
| 22 |
{ |
| 23 |
foo(); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
void bar(int x) { } |
| 28 |
|
| 29 |
void main () |
| 30 |
{ |
| 31 |
A a; |
| 32 |
a ~= bar (1); // OK |
| 33 |
a = bar (1); // Error: expression bar(1) is void and has no value |
| 34 |
|
| 35 |
C c = new C; |
| 36 |
c ~= bar(1); |
| 37 |
c = bar(1); |
| 38 |
} |