gcc/testsuite/g++.dg/cpp0x/fntmpdefarg2a.C
raw| 1 | // PR c++/46831 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | // { dg-options "" } |
| 4 | |
| 5 | struct B { }; |
| 6 | struct D : B { }; |
| 7 | struct A { |
| 8 | template<typename T = void> operator D&(); |
| 9 | operator long(); |
| 10 | }; |
| 11 | |
| 12 | template <> A::operator D&(); // { dg-message "template conversion" } |
| 13 | |
| 14 | void f(long); |
| 15 | void f(B&); |
| 16 | |
| 17 | struct A2 { |
| 18 | template<typename T = void> operator B&(); |
| 19 | }; |
| 20 | |
| 21 | void f2(const B&); |
| 22 | |
| 23 | int main() { |
| 24 | f(A()); |
| 25 | f2(A2()); |
| 26 | f2(A()); // { dg-error "" } |
| 27 | } |