| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/diag20888.d(24): Error: return value `callback` of type `int function()` does not match return type `int`, and cannot be implicitly converted |
| 5 |
fail_compilation/diag20888.d(24): Did you intend to call the function pointer? |
| 6 |
fail_compilation/diag20888.d(29): Error: return value `s` of type `string` does not match return type `int`, and cannot be implicitly converted |
| 7 |
fail_compilation/diag20888.d(34): Error: return value `callback` of type `int delegate()` does not match return type `int`, and cannot be implicitly converted |
| 8 |
fail_compilation/diag20888.d(34): Did you intend to call the delegate? |
| 9 |
fail_compilation/diag20888.d(39): Error: return value `callback` of type `int delegate()` does not match return type `int`, and cannot be implicitly converted |
| 10 |
fail_compilation/diag20888.d(39): Did you intend to call the delegate? |
| 11 |
fail_compilation/diag20888.d(44): Error: return value `callback` of type `int delegate()*` does not match return type `int`, and cannot be implicitly converted |
| 12 |
fail_compilation/diag20888.d(49): Error: return value `callback` of type `int delegate()` does not match return type `string`, and cannot be implicitly converted |
| 13 |
fail_compilation/diag20888.d(54): Error: return value `() => 3755` of type `int function() pure nothrow @nogc @safe` does not match return type `int`, and cannot be implicitly converted |
| 14 |
fail_compilation/diag20888.d(54): Did you intend to call the function pointer? |
| 15 |
fail_compilation/diag20888.d(59): Error: `return` expression expected |
| 16 |
fail_compilation/diag20888.d(64): Error: cannot return non-void from `void` function |
| 17 |
fail_compilation/diag20888.d(70): Error: return value `() => i` of type `int delegate() pure nothrow @nogc @safe` does not match return type `int`, and cannot be implicitly converted |
| 18 |
fail_compilation/diag20888.d(70): Did you intend to call the delegate? |
| 19 |
--- |
| 20 |
*/ |
| 21 |
|
| 22 |
int alpha(int function() callback) |
| 23 |
{ |
| 24 |
return callback; |
| 25 |
} |
| 26 |
|
| 27 |
int beta(string s) |
| 28 |
{ |
| 29 |
return s; |
| 30 |
} |
| 31 |
|
| 32 |
int gamma(int delegate() callback) |
| 33 |
{ |
| 34 |
return callback; |
| 35 |
} |
| 36 |
|
| 37 |
int delta(int delegate() callback) |
| 38 |
{ |
| 39 |
return callback; |
| 40 |
} |
| 41 |
|
| 42 |
int epsilon(int delegate()* callback) |
| 43 |
{ |
| 44 |
return callback; // no supplemental yet |
| 45 |
} |
| 46 |
|
| 47 |
string zeta(int delegate() callback) |
| 48 |
{ |
| 49 |
return callback; |
| 50 |
} |
| 51 |
|
| 52 |
int eta() |
| 53 |
{ |
| 54 |
return () => 0xEAB; |
| 55 |
} |
| 56 |
|
| 57 |
int theta() |
| 58 |
{ |
| 59 |
return; |
| 60 |
} |
| 61 |
|
| 62 |
void iota() |
| 63 |
{ |
| 64 |
return 0xEAB; |
| 65 |
} |
| 66 |
|
| 67 |
int kappa() |
| 68 |
{ |
| 69 |
int i = 0xEAB; |
| 70 |
return () { return i; }; |
| 71 |
} |