When we run into a constructor or destructor that is defined in the
wrong class, make sure to drop it immediately; we don't want that
constructor to be available within the DeclContext. Fixes
<rdar://problem/9677163>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143506 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/member-class-11.cpp b/test/SemaCXX/member-class-11.cpp
new file mode 100644
index 0000000..c230c53
--- /dev/null
+++ b/test/SemaCXX/member-class-11.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+struct rdar9677163 {
+  struct Y { ~Y(); };
+  struct Z { ~Z(); };
+  Y::~Y() { } // expected-error{{non-friend class member '~Y' cannot have a qualified name}}
+  ~Z(); // expected-error{{expected the class name after '~' to name the enclosing class}}
+};