void Sema::FinalizeVarWithDestructor(VarDecl *VD, const RecordType *Record) {
CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Record->getDecl());
- if (!ClassDecl->hasTrivialDestructor()) {
+ if (!ClassDecl->isInvalidDecl() && !VD->isInvalidDecl() &&
+ !ClassDecl->hasTrivialDestructor()) {
CXXDestructorDecl *Destructor = ClassDecl->getDestructor(Context);
MarkDeclarationReferenced(VD->getLocation(), Destructor);
CheckDestructorAccess(VD->getLocation(), Record);
struct Y {
~X(); // expected-error {{expected the class name after '~' to name the enclosing class}}
};
+
+namespace PR6421 {
+ class T; // expected-note{{forward declaration}}
+
+ class QGenericArgument
+ {
+ template<typename U>
+ void foo(T t) // expected-error{{variable has incomplete type}}
+ { }
+
+ void disconnect()
+ {
+ T* t;
+ bob<QGenericArgument>(t); // expected-error{{undeclared identifier 'bob'}}
+ }
+ };
+}