diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-03 19:09:14 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-03 19:09:14 +0000 |
commit | 225c41eb3e960fd2e1d1b547f0f19a278d608bc5 (patch) | |
tree | af6555cae069fe2e89a6fa956ef044ffb8723ca8 /test | |
parent | 396b7cd9f6b35d87d17ae03e9448b5c1f2184598 (diff) |
Standard conversion sequences now have a CopyConstructor field, to
cope with the case where a user-defined conversion is actually a copy
construction, and therefore can be compared against other standard
conversion sequences. While I called this a hack before, now I'm
convinced that it's the right way to go.
Compare overloads based on derived-to-base conversions that invoke
copy constructors.
Suppress user-defined conversions when attempting to call a
user-defined conversion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/SemaCXX/converting-constructor.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/overload-call-copycon.cpp | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/test/SemaCXX/converting-constructor.cpp b/test/SemaCXX/converting-constructor.cpp index 4bcd5aa01e..b99a134328 100644 --- a/test/SemaCXX/converting-constructor.cpp +++ b/test/SemaCXX/converting-constructor.cpp @@ -1,4 +1,4 @@ -// RUN: clang -fsyntax-only %s +// RUN: clang -fsyntax-only -verify %s class Z { }; class Y { @@ -18,6 +18,6 @@ void g(short s, Y y, Z z) { f(s); f(1.0f); f(y); - f(z); // expected-error{{incompatible}} + f(z); // expected-error{{incompatible type passing 'class Z', expected 'class X'}} } diff --git a/test/SemaCXX/overload-call-copycon.cpp b/test/SemaCXX/overload-call-copycon.cpp index 8270928577..281f4ce343 100644 --- a/test/SemaCXX/overload-call-copycon.cpp +++ b/test/SemaCXX/overload-call-copycon.cpp @@ -36,3 +36,13 @@ void test_copycon3(B b, const B bc) { int& i1 = copycon3(b); float& f1 = copycon3(bc); } + + +class C : public B { }; + +float& copycon4(A a); +int& copycon4(B b); + +void test_copycon4(C c) { + int& i = copycon4(c); +}; |