Improve our handling of C++ [class.copy]p3, which specifies that a
constructor template will not be used to copy a class object to a
value of its own type. We were eliminating all constructor templates
whose specializations look like a copy constructor, which eliminated
important candidates. Fixes PR8182.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118418 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp
index b6ca72e..cf3fdfb 100644
--- a/test/SemaTemplate/constructor-template.cpp
+++ b/test/SemaTemplate/constructor-template.cpp
@@ -71,16 +71,16 @@
 template<> X3::X3(X3); // expected-error{{must pass its first argument by reference}}
 
 struct X4 {
-  X4(); // expected-note{{candidate constructor}}
+  X4();
   ~X4();
-  X4(X4&);	// expected-note {{candidate constructor}}
+  X4(X4&);
   template<typename T> X4(const T&, int = 17);
 };
 
 X4 test_X4(bool Cond, X4 x4) {
   X4 a(x4, 17); // okay, constructor template
   X4 b(x4); // okay, copy constructor
-  return X4(); // expected-error{{no matching constructor}}
+  return X4();
 }
 
 // Instantiation of a non-dependent use of a constructor
@@ -109,3 +109,20 @@
   X5<X6> tf;
   X5<X6> tf2(tf);
 }
+
+namespace PR8182 {
+  struct foo {
+    foo();
+    template<class T> foo(T&);
+
+  private:
+    foo(const foo&);
+  };
+
+  void test_foo() {
+    foo f1;
+    foo f2(f1);
+    foo f3 = f1;
+  }
+
+}