| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail10534.d(24): Error: illegal operator `+` for `a` of type `int delegate()` |
| 5 |
fail_compilation/fail10534.d(24): Error: illegal operator `+` for `b` of type `int delegate()` |
| 6 |
fail_compilation/fail10534.d(25): Error: illegal operator `-` for `a` of type `int delegate()` |
| 7 |
fail_compilation/fail10534.d(25): Error: illegal operator `-` for `b` of type `int delegate()` |
| 8 |
fail_compilation/fail10534.d(26): Error: illegal operator `/` for `a` of type `int delegate()` |
| 9 |
fail_compilation/fail10534.d(27): Error: illegal operator `*` for `a` of type `int delegate()` |
| 10 |
fail_compilation/fail10534.d(32): Error: illegal operator `+` for `a` of type `int function()` |
| 11 |
fail_compilation/fail10534.d(32): Error: illegal operator `+` for `b` of type `int function()` |
| 12 |
fail_compilation/fail10534.d(33): Error: illegal operator `-` for `a` of type `int function()` |
| 13 |
fail_compilation/fail10534.d(33): Error: illegal operator `-` for `b` of type `int function()` |
| 14 |
fail_compilation/fail10534.d(34): Error: illegal operator `/` for `a` of type `int function()` |
| 15 |
fail_compilation/fail10534.d(35): Error: illegal operator `*` for `a` of type `int function()` |
| 16 |
--- |
| 17 |
*/ |
| 18 |
|
| 19 |
void main() |
| 20 |
{ |
| 21 |
{ |
| 22 |
int delegate() a = ()=>5; |
| 23 |
int delegate() b = ()=>5; |
| 24 |
auto c1 = a + b; // passes (and will crash if c1() called) |
| 25 |
auto c2 = a - b; // passes (and will crash if c2() called) |
| 26 |
auto c3 = a / b; // a & b not of arithmetic type |
| 27 |
auto c4 = a * b; // a & b not of arithmetic type |
| 28 |
} |
| 29 |
{ |
| 30 |
int function() a = ()=>5; |
| 31 |
int function() b = ()=>5; |
| 32 |
auto c1 = a + b; |
| 33 |
auto c2 = a - b; |
| 34 |
auto c3 = a / b; |
| 35 |
auto c4 = a * b; |
| 36 |
} |
| 37 |
} |