Implement C++ copy-initialization for declarations. There is now some
duplication in the handling of copy-initialization by constructor,
which occurs both for initialization of a declaration and for
overloading. The initialization code is due for some refactoring.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58756 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp
new file mode 100644
index 0000000..17028da
--- /dev/null
+++ b/test/SemaCXX/copy-initialization.cpp
@@ -0,0 +1,17 @@
+// RUN: clang -fsyntax-only -verify %s 
+
+class X {
+public:
+  explicit X(const X&);
+  X(int*); // expected-note{{candidate function}}
+  explicit X(float*);
+};
+
+class Y : public X { };
+
+void f(Y y, int *ip, float *fp) {
+  X x1 = y; // expected-error{{no matching constructor for initialization of 'x1'; candidates are:}}
+  X x2 = 0;
+  X x3 = ip;
+  X x4 = fp; // expected-error{{incompatible type initializing 'x4', expected 'class X'}}
+}
diff --git a/test/SemaCXX/direct-initializer.cpp b/test/SemaCXX/direct-initializer.cpp
index 952e132..d5b91bb 100644
--- a/test/SemaCXX/direct-initializer.cpp
+++ b/test/SemaCXX/direct-initializer.cpp
@@ -20,9 +20,9 @@
   X(float, Y); // expected-note{{candidate function}}
 };
 
-class Z { // expected-note{{candidate function}}
+class Z {
 public:
-  Z(int); // expected-note{{candidate function}}
+  Z(int);
 };
 
 void g() {
@@ -32,5 +32,5 @@
   Y y(1.0);
   X x4(3.14, y);
 
-  Z z; // expected-error{{no matching constructor for initialization of 'z'; candidates are:}}
+  Z z; // expected-error{{no matching constructor for initialization of 'z'}}
 }