When creating the implicitly-declared special member functions, be
sure to introduce them into the current Scope (when we have one) in
addition to the DeclContext for the class, so that they can be found
by name lookup for inline members of the class. Fixes PR6570.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101047 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/implicit-member-functions.cpp b/test/SemaCXX/implicit-member-functions.cpp
index 40a61e4..2112188 100644
--- a/test/SemaCXX/implicit-member-functions.cpp
+++ b/test/SemaCXX/implicit-member-functions.cpp
@@ -12,3 +12,30 @@
 struct D { }; // expected-note {{previous implicit declaration is here}}
 D::~D() { } // expected-error {{definition of implicitly declared destructor}}
 
+// Make sure that the special member functions are introduced for
+// name-lookup purposes and overload with user-declared
+// constructors and assignment operators.
+namespace PR6570 {
+  class A { };
+
+  class B {
+  public:
+    B() {}
+
+    B(const A& a) {
+      operator = (CONST);
+      operator = (a);
+    }
+
+    B& operator = (const A& a) {
+      return *this;
+    }
+
+    void f(const A &a) {
+      B b(a);
+    };
+
+    static const B CONST;
+  };
+
+}