Fix/test decltype dtor calls with invalid base expression.

llvm-svn: 146354
This commit is contained in:
David Blaikie 2011-12-12 04:13:55 +00:00
parent 42b8bb5033
commit 08608f6744
2 changed files with 2 additions and 1 deletions

View File

@ -266,7 +266,7 @@ ParsedType Sema::getDestructorName(SourceLocation TildeLoc,
}
ParsedType Sema::getDestructorType(const DeclSpec& DS, ParsedType ObjectType) {
if (DS.getTypeSpecType() == DeclSpec::TST_error)
if (DS.getTypeSpecType() == DeclSpec::TST_error || !ObjectType)
return ParsedType();
assert(DS.getTypeSpecType() == DeclSpec::TST_decltype
&& "only get destructor types from declspecs");

View File

@ -22,4 +22,5 @@ void a(const A *x) {
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}}
// 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'}}
}