gcc/testsuite/g++.dg/template/pr87989.C
raw| 1 | // PR c++/87989 |
| 2 | // { dg-do link } |
| 3 | // Resolved to template instantiation rather than non-template fn. |
| 4 | |
| 5 | struct X { |
| 6 | template <class T> operator T() const; // no definition |
| 7 | operator float() const {return 0.f;} |
| 8 | }; |
| 9 | |
| 10 | template <class T> |
| 11 | T f(const X &x) { |
| 12 | // Resoved in error to X::operator float<float>() const` |
| 13 | // instead of correct `X::operator float() const |
| 14 | return x.operator T(); |
| 15 | } |
| 16 | |
| 17 | int main () |
| 18 | { |
| 19 | return f<float>(X ()); |
| 20 | } |