| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/named_arguments_error.d(37): Error: function `f` is not callable using argument types `(int, int, int)` |
| 5 |
fail_compilation/named_arguments_error.d(37): parameter `x` assigned twice |
| 6 |
fail_compilation/named_arguments_error.d(31): `named_arguments_error.f(int x, int y, int z)` declared here |
| 7 |
fail_compilation/named_arguments_error.d(38): Error: function `f` is not callable using argument types `(int, int, int)` |
| 8 |
fail_compilation/named_arguments_error.d(38): argument `4` goes past end of parameter list |
| 9 |
fail_compilation/named_arguments_error.d(31): `named_arguments_error.f(int x, int y, int z)` declared here |
| 10 |
fail_compilation/named_arguments_error.d(39): Error: function `f` is not callable using argument types `(int, int, int)` |
| 11 |
fail_compilation/named_arguments_error.d(39): parameter `y` assigned twice |
| 12 |
fail_compilation/named_arguments_error.d(31): `named_arguments_error.f(int x, int y, int z)` declared here |
| 13 |
fail_compilation/named_arguments_error.d(40): Error: function `f` is not callable using argument types `(int, int, int)` |
| 14 |
fail_compilation/named_arguments_error.d(40): no parameter named `a` |
| 15 |
fail_compilation/named_arguments_error.d(31): `named_arguments_error.f(int x, int y, int z)` declared here |
| 16 |
fail_compilation/named_arguments_error.d(41): Error: function `g` is not callable using argument types `(int, int)` |
| 17 |
fail_compilation/named_arguments_error.d(41): missing argument for parameter #1: `int x` |
| 18 |
fail_compilation/named_arguments_error.d(33): `named_arguments_error.g(int x, int y, int z = 3)` declared here |
| 19 |
fail_compilation/named_arguments_error.d(43): Error: no named argument `element` allowed for array dimension |
| 20 |
fail_compilation/named_arguments_error.d(44): Error: no named argument `number` allowed for scalar |
| 21 |
fail_compilation/named_arguments_error.d(45): Error: cannot implicitly convert expression `g(x: 3, y: 4, z: 5)` of type `int` to `string` |
| 22 |
fail_compilation/named_arguments_error.d(46): Error: template `tempfun` is not callable using argument types `!()(int, int)` |
| 23 |
fail_compilation/named_arguments_error.d(49): Candidate is: `tempfun(T, U)(T t, U u)` |
| 24 |
--- |
| 25 |
*/ |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
void f(int x, int y, int z); |
| 32 |
|
| 33 |
int g(int x, int y, int z = 3); |
| 34 |
|
| 35 |
void main() |
| 36 |
{ |
| 37 |
f(x: 3, x: 3, 5); |
| 38 |
f(z: 3, 4, 5); |
| 39 |
f(y: 3, x: 4, 5); |
| 40 |
f(a: 3, b: 4, 5); |
| 41 |
g(y: 4, z: 3); |
| 42 |
|
| 43 |
auto g0 = new int[](element: 3); |
| 44 |
auto g1 = new int(number: 3); |
| 45 |
string s = g(x: 3, y: 4, z: 5); |
| 46 |
enum x = tempfun(u: 0, 1); |
| 47 |
} |
| 48 |
|
| 49 |
int tempfun(T, U)(T t, U u) |
| 50 |
{ |
| 51 |
return 3; |
| 52 |
} |