| 1 |
/** |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/diag_funclit.d(103): Error: function literal `(x, y, z) { return 42; }` is not callable using argument types `()` |
| 5 |
fail_compilation/diag_funclit.d(103): too few arguments, expected 3, got 0 |
| 6 |
fail_compilation/diag_funclit.d(106): Error: `(x, y, z) { return 42; }` is not callable using argument types `(int, string, int, int)` |
| 7 |
fail_compilation/diag_funclit.d(106): too many arguments, expected 3, got 4 |
| 8 |
fail_compilation/diag_funclit.d(108): Error: `(x, y, string z = "Hello") { return x; }` is not callable using argument types `(int, int, string, string)` |
| 9 |
fail_compilation/diag_funclit.d(108): too many arguments, expected 3, got 4 |
| 10 |
fail_compilation/diag_funclit.d(110): Error: `(x, y, string z = "Hello") { return x; }` is not callable using argument types `(int)` |
| 11 |
fail_compilation/diag_funclit.d(110): too few arguments, expected 3, got 1 |
| 12 |
fail_compilation/diag_funclit.d(112): Error: `(x, y, z) { return x; }` is not callable using argument types `(int)` |
| 13 |
fail_compilation/diag_funclit.d(112): too few arguments, expected 3, got 1 |
| 14 |
fail_compilation/diag_funclit.d(115): Error: `(x, y, ...) { return x; }` is not callable using argument types `(int)` |
| 15 |
fail_compilation/diag_funclit.d(115): too few arguments, expected 2, got 1 |
| 16 |
fail_compilation/diag_funclit.d(117): Error: `(x, y, string z = "Hey", ...) { return x; }` is not callable using argument types `(int)` |
| 17 |
fail_compilation/diag_funclit.d(117): too few arguments, expected 3, got 1 |
| 18 |
--- |
| 19 |
*/ |
| 20 |
|
| 21 |
#line 100 |
| 22 |
void main() |
| 23 |
{ |
| 24 |
// No argument |
| 25 |
(x, y, z) { return 42; }(); |
| 26 |
|
| 27 |
// Too many args, non-variadic |
| 28 |
(x, y, z) { return 42; }(42, "Hello", 42, 42); |
| 29 |
// Too many args, non-variadic, default param |
| 30 |
(x, y, string z = "Hello") { return x; }(42, 42, "Nope", "Noooope"); |
| 31 |
// Too few args, non-variadic |
| 32 |
(x, y, string z = "Hello") { return x; }(42); |
| 33 |
// Too few args, non-variadic, default param |
| 34 |
(x, y, z) { return x; }(42); |
| 35 |
|
| 36 |
// Too few args, variadic |
| 37 |
(x, y, ...) { return x; }(42); |
| 38 |
// Too few args, variadic, default param |
| 39 |
(x, y, string z = "Hey", ...) { return x; }(42); |
| 40 |
} |