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 | 6f5431543a701c54293a977c28844e9862f8f491 (patch) | |
tree | f3b6e7832720b29d309135362b053bea120af5d5 /clang/test/SemaCXX/copy-initialization.cpp | |
parent | bfd58d87f31f4c24604965d919b8bbdaa6ac9ff6 (diff) | |
download | bcm5719-llvm-6f5431543a701c54293a977c28844e9862f8f491.tar.gz bcm5719-llvm-6f5431543a701c54293a977c28844e9862f8f491.zip |
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.
llvm-svn: 58756
Diffstat (limited to 'clang/test/SemaCXX/copy-initialization.cpp')
-rw-r--r-- | clang/test/SemaCXX/copy-initialization.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/copy-initialization.cpp b/clang/test/SemaCXX/copy-initialization.cpp new file mode 100644 index 00000000000..17028da0692 --- /dev/null +++ b/clang/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'}} +} |