gcc/testsuite/gdc.test/compilable/test21743.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=21743 |
| 2 | |
| 3 | struct A |
| 4 | { |
| 5 | int foo(int a) { return a; } |
| 6 | string foo()(string b) { return b; } |
| 7 | } |
| 8 | |
| 9 | alias ov = __traits(getOverloads, A.init, "foo", true); |
| 10 | |
| 11 | // member function works |
| 12 | static assert(ov[0](1) == 1); |
| 13 | |
| 14 | // member template used to fail with the gagged error: |
| 15 | // 'need this for foo of type pure nothrow @nogc @safe string(string b)' |
| 16 | static assert(ov[1]("a") == "a"); |