gcc/testsuite/g++.dg/template/sfinae-dr657.C
raw| 1 | // DR 657 SUPERSEDED BY P0929 |
| 2 | // Test that a return or parameter type with abstract class type DOES NOT cause |
| 3 | // a deduction failure or conversion failure. |
| 4 | |
| 5 | struct A |
| 6 | { |
| 7 | A(); |
| 8 | A(int); |
| 9 | virtual void f() = 0; |
| 10 | }; |
| 11 | |
| 12 | template<class T> T declval(); |
| 13 | template<class T> int declval(...); |
| 14 | |
| 15 | template<class T> void arg(T); |
| 16 | template<class T> int arg(...); |
| 17 | |
| 18 | int main() |
| 19 | { |
| 20 | int i = declval<A>(); // { dg-error "ambiguous" } |
| 21 | i = arg<A>(1); // { dg-error "abstract" } |
| 22 | } |