| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
---- |
| 4 |
fail_compilation/ice14923.d(23): Error: function `parse` is not callable using argument types `(A)` |
| 5 |
fail_compilation/ice14923.d(23): cannot pass argument `b` of type `ice14923.A` to parameter `C a` |
| 6 |
fail_compilation/ice14923.d(21): `ice14923.parse(C a)` declared here |
| 7 |
fail_compilation/ice14923.d(23): instantiated from here: `bar!((b) => parse(b))` |
| 8 |
---- |
| 9 |
*/ |
| 10 |
|
| 11 |
auto bar(alias fun)() |
| 12 |
{ |
| 13 |
size_t counter; |
| 14 |
scope(exit) counter++; |
| 15 |
|
| 16 |
Object a2; |
| 17 |
if (auto ai = cast(A)a2) return fun(ai); |
| 18 |
if (auto ai = cast(B)a2) return fun(ai); |
| 19 |
} |
| 20 |
|
| 21 |
void parse(C a) |
| 22 |
{ |
| 23 |
bar!(b => parse(b))(); |
| 24 |
} |
| 25 |
|
| 26 |
class A {} |
| 27 |
|
| 28 |
class C {} |
| 29 |
|
| 30 |
class B : C {} |