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'}}
+}