When clearing a LookupResult structure, clear out the naming class,
too. Fixes PR7900.
While I'm in this area, improve the diagnostic when the type being
destroyed doesn't match either of the types we found.
llvm-svn: 127041
diff --git a/clang/test/SemaCXX/destructor.cpp b/clang/test/SemaCXX/destructor.cpp
index 14a4fb8..01f21de 100644
--- a/clang/test/SemaCXX/destructor.cpp
+++ b/clang/test/SemaCXX/destructor.cpp
@@ -177,3 +177,16 @@
class B { public: ~B(); };
class C : virtual B { public: ~C() { } };
}
+
+namespace PR7900 {
+ struct A { // expected-note 2{{type 'PR7900::A' is declared here}}
+ };
+ struct B : public A {
+ };
+ void foo() {
+ B b;
+ b.~B();
+ b.~A(); // expected-error{{destructor type 'PR7900::A' in object destruction expression does not match the type 'PR7900::B' of the object being destroyed}}
+ (&b)->~A(); // expected-error{{destructor type 'PR7900::A' in object destruction expression does not match the type 'PR7900::B' of the object being destroyed}}
+ }
+}