| 1 |
// PR c++/32241 |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
struct A |
| 5 |
{ |
| 6 |
typedef int T; |
| 7 |
T &foo (); |
| 8 |
A () { foo.~T (); } // { dg-error "10:invalid use of member function|expected" } |
| 9 |
}; |
| 10 |
|
| 11 |
template <typename T> struct B |
| 12 |
{ |
| 13 |
T &foo (); |
| 14 |
B () { foo.~T (); } // { dg-error "10:invalid use of member" } |
| 15 |
}; |
| 16 |
|
| 17 |
B<int> b; |
| 18 |
|
| 19 |
template <typename T, typename S> struct C |
| 20 |
{ |
| 21 |
T t; |
| 22 |
C () { t.~S (); } // { dg-error "13:is not of type" } |
| 23 |
}; |
| 24 |
|
| 25 |
C<int, long int> c; |
| 26 |
|
| 27 |
template <typename T> struct D |
| 28 |
{ |
| 29 |
T t; |
| 30 |
typedef long int U; |
| 31 |
D () { t.~U (); } // { dg-error "10:is not of type" } |
| 32 |
}; |
| 33 |
|
| 34 |
D<int> d; |
| 35 |
|
| 36 |
template <typename T> struct E |
| 37 |
{ |
| 38 |
T &foo (); |
| 39 |
typedef long int U; |
| 40 |
E () { foo.~U (); } // { dg-error "10:invalid use of member" } |
| 41 |
}; |
| 42 |
|
| 43 |
E<int> e; |