Don't try to finalize an ill-formed variable or one whose class type is ill-formed. Fixes PR6421
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97152 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp
index a0c2c1e..ab3c809 100644
--- a/test/SemaCXX/destructor.cpp
+++ b/test/SemaCXX/destructor.cpp
@@ -61,3 +61,20 @@
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'}}
+ }
+ };
+}