diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-05 15:29:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-05 15:29:30 +0000 |
commit | f03d7c7af2ca8555c513ba7667acffb667445ecd (patch) | |
tree | ccbec86bd811939366a570861a353ef170d69763 /test/SemaCXX/copy-initialization.cpp | |
parent | 7ad8390f7992ab7f19b1460c5f0b9d96f165c4e9 (diff) |
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
Diffstat (limited to 'test/SemaCXX/copy-initialization.cpp')
-rw-r--r-- | test/SemaCXX/copy-initialization.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp new file mode 100644 index 0000000000..17028da069 --- /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'}} +} |