diff options
author | David Blaikie <dblaikie@gmail.com> | 2011-12-16 16:03:09 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2011-12-16 16:03:09 +0000 |
commit | 91ec7894ec186dd36f509682f00486c98d8228ed (patch) | |
tree | cd1be2e88bce92c22296a1293f3de6e570deadad /test/CXX/special | |
parent | 6b65d4a9cc5aed96a7f1a36e75dd9c4adb164e0b (diff) |
Support decltype in pseudo destructors and dependent destructor calls.
Reviewed by Eli Friedman.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146738 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/special')
-rw-r--r-- | test/CXX/special/class.dtor/p10-0x.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/test/CXX/special/class.dtor/p10-0x.cpp b/test/CXX/special/class.dtor/p10-0x.cpp index 7f0c07011e..e10afb52e2 100644 --- a/test/CXX/special/class.dtor/p10-0x.cpp +++ b/test/CXX/special/class.dtor/p10-0x.cpp @@ -5,16 +5,18 @@ struct A { ~A(); }; struct B {}; template<typename T> void b(const T *x, const A *y) { - // FIXME: this parses as a pseudo destructor call which doesn't have decltype support yet - x->~decltype(T())(); // expected-error{{expected a class name after '~' to name a destructor}} + x->~decltype(T())(); + x->~decltype(*x)(); // expected-error{{the type of object expression ('const int') does not match the type being destroyed ('decltype(*x)' (aka 'const int &')) in pseudo-destructor expression}} \ + expected-error{{no member named '~const struct A &' in 'A'}} + x->~decltype(int())(); // expected-error{{no member named '~int' in 'A'}} y->~decltype(*y)(); // expected-error{{destructor type 'decltype(*y)' (aka 'const A &') in object destruction expression does not match the type 'const A' of the object being destroyed}} y->~decltype(T())(); // expected-error{{destructor type 'decltype(T())' in object destruction expression does not match the type 'const A' of the object being destroyed}} y->~decltype(A())(); } -template void b(const int*, const A*); -template void b(const A*,const A*); -void a(const A *x) { +template void b(const int*, const A*); // expected-note{{in instantiation of function template specialization 'b<int>' requested here}} +template void b(const A*,const A*); // expected-note{{in instantiation of function template specialization 'b<A>' requested here}} +void a(const A *x, int i, int *pi) { x->~decltype(A())(); x->~decltype(*x)(); // expected-error{{destructor type 'decltype(*x)' (aka 'const A &') in object destruction expression does not match the type 'const A' of the object being destroyed}} x->~decltype()(); // expected-error{{expected expression}} @@ -23,4 +25,15 @@ void a(const A *x) { // this last one could be better, mentioning that the nested-name-specifier could be removed or a type name after the ~ x->::A::~decltype(*x)(); // expected-error{{expected a class name after '~' to name a destructor}} y->~decltype(A())(); // expected-error{{use of undeclared identifier 'y'}} + + typedef int *intp; + i->~decltype(int())(); // expected-error{{member reference type 'int' is not a pointer; maybe you meant to use '.'?}} + i.~decltype(int())(); + i->~decltype(intp())(); // expected-error{{member reference type 'int' is not a pointer; maybe you meant to use '.'?}} \ + expected-error{{the type of object expression ('int') does not match the type being destroyed ('decltype(intp())' (aka 'int *')) in pseudo-destructor expression}} + i.~decltype(intp())(); // expected-error{{the type of object expression ('int') does not match the type being destroyed ('decltype(intp())' (aka 'int *')) in pseudo-destructor expression}} + pi->~decltype(int())(); + pi.~decltype(int())(); // expected-error{{the type of object expression ('int *') does not match the type being destroyed ('decltype(int())' (aka 'int')) in pseudo-destructor expression}} + pi.~decltype(intp())(); + pi->~decltype(intp())(); // expected-error{{the type of object expression ('int') does not match the type being destroyed ('decltype(intp())' (aka 'int *')) in pseudo-destructor expression}} } |