| 1 |
// { dg-do assemble } |
| 2 |
|
| 3 |
template<class T> |
| 4 |
class TestClass1 { |
| 5 |
public: |
| 6 |
TestClass1() { } |
| 7 |
}; |
| 8 |
|
| 9 |
template<class T> |
| 10 |
class TestClass2 { |
| 11 |
public: |
| 12 |
TestClass2() { } |
| 13 |
T operator()(int) { } |
| 14 |
}; |
| 15 |
|
| 16 |
template<class T> |
| 17 |
void doit(T x) { |
| 18 |
TestClass1<T> q1; |
| 19 |
q1 = TestClass1<T>(); |
| 20 |
TestClass2<T> q2; |
| 21 |
q2 = TestClass2<T>(); |
| 22 |
|
| 23 |
TestClass1<T> p1; |
| 24 |
p1 = TestClass1(); // { dg-error "19:class template argument deduction failed|no match" "" { target c++17 } } template used as expression |
| 25 |
// { dg-error "18:missing template arguments" "" { target c++14_down } .-1 } |
| 26 |
|
| 27 |
TestClass2<T> p2; |
| 28 |
p2 = TestClass2(); // { dg-error "19:class template argument deduction failed|no match" "" { target c++17 } } template used as expression |
| 29 |
// { dg-error "18:missing template arguments" "" { target c++14_down } .-1 } |
| 30 |
} |
| 31 |
|
| 32 |
int main() { |
| 33 |
double x; |
| 34 |
doit(x); |
| 35 |
} |
| 36 |
|