Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/test23786.d

raw
1 /* TEST_OUTPUT:
2 ---
3 fail_compilation/test23786.d(22): Error: function `foo` is not callable using argument types `(double)`
4 fail_compilation/test23786.d(22): cannot pass argument `1.0` of type `double` to parameter `int i`
5 fail_compilation/test23786.d(19): `test23786.foo(int i)` declared here
6 fail_compilation/test23786.d(29): Error: function `bar` is not callable using argument types `(int*)`
7 fail_compilation/test23786.d(29): cannot pass argument `& i` of type `int*` to parameter `int i`
8 fail_compilation/test23786.d(26): `test23786.bar(int i)` declared here
9 fail_compilation/test23786.d(37): Error: function `baz` is not callable using argument types `(int*)`
10 fail_compilation/test23786.d(37): cannot pass argument `& i` of type `int*` to parameter `int i`
11 fail_compilation/test23786.d(34): `test23786.baz(int i)` declared here
12 ---
13 */
14
15 // https://issues.dlang.org/show_bug.cgi?id=23786
16
17 module test23786;
18
19 void foo(int i)
20 {
21 static assert(__traits(parent, {}).mangleof == "_D9test237863fooFiZv");
22 __traits(parent, {})(1.0);
23 }
24 void foo(int* p) {}
25
26 void bar(int i)
27 {
28 static assert(__traits(parent, {}).mangleof == "_D9test237863barFiZv");
29 __traits(parent, {})(&i);
30 }
31 void bar(int* p) {}
32
33 void baz(int* p) {}
34 void baz(int i)
35 {
36 static assert(__traits(parent, {}).mangleof == "_D9test237863bazFiZv");
37 __traits(parent, {})(&i);
38 }
39 void baz(float* p) {}