Fix/test decltype dtor calls with invalid base expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146354 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2011-12-12 04:13:55 +00:00
Родитель e3d250e488
Коммит 4db8c4483e
2 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -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");

Просмотреть файл

@ -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'}}
}