diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-03 17:51:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-03 17:51:48 +0000 |
commit | 0537942f3c3271027f708b7ac872e7149e15be37 (patch) | |
tree | 450f5ebc7aaaa33f962b01e4628b1c2c2031bb84 /clang/test/SemaCXX/overload-call-copycon.cpp | |
parent | d395a1722d7cbd0170fe4b4737c93814edaf7b56 (diff) | |
download | bcm5719-llvm-0537942f3c3271027f708b7ac872e7149e15be37.tar.gz bcm5719-llvm-0537942f3c3271027f708b7ac872e7149e15be37.zip |
Add implicitly-declared default and copy constructors to C++ classes,
when appropriate.
Conversions for class types now make use of copy constructors. I've
replaced the egregious hack allowing class-to-class conversions with a
slightly less egregious hack calling these conversions standard
conversions (for overloading reasons).
llvm-svn: 58622
Diffstat (limited to 'clang/test/SemaCXX/overload-call-copycon.cpp')
-rw-r--r-- | clang/test/SemaCXX/overload-call-copycon.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/overload-call-copycon.cpp b/clang/test/SemaCXX/overload-call-copycon.cpp new file mode 100644 index 00000000000..82709285770 --- /dev/null +++ b/clang/test/SemaCXX/overload-call-copycon.cpp @@ -0,0 +1,38 @@ +// RUN: clang -fsyntax-only %s +class X { }; + +int& copycon(X x); +float& copycon(...); + +void test_copycon(X x, X const xc, X volatile xv) { + int& i1 = copycon(x); + int& i2 = copycon(xc); + float& f1 = copycon(xv); +} + +class A { +public: + A(A&); +}; + +class B : public A { }; + +short& copycon2(A a); +int& copycon2(B b); +float& copycon2(...); + +void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) { + int& i1 = copycon2(b); + float& f1 = copycon2(bc); + float& f2 = copycon2(bv); + short& s1 = copycon2(a); + float& f3 = copycon2(ac); +} + +int& copycon3(A a); +float& copycon3(...); + +void test_copycon3(B b, const B bc) { + int& i1 = copycon3(b); + float& f1 = copycon3(bc); +} |