aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/copy-initialization.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-17 22:01:05 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-17 22:01:05 +0000
commit3fbaf3e5d524bfff219d1e3e9ac4801a8411590f (patch)
treefa5ce3a9ca1ba76a1c6e063ba6e70fefa2ccae4f /test/SemaCXX/copy-initialization.cpp
parent4803535dfef2626d2aec18ef92450b5008945352 (diff)
Improve our handling of user-defined conversions as part of overload
resolution. There are two sources of problems involving user-defined conversions that this change eliminates, along with providing simpler interfaces for checking implicit conversions: - It eliminates a case of infinite recursion found in Boost. - It eliminates the search for the constructor needed to copy a temporary generated by an implicit conversion from overload resolution. Overload resolution assumes that, if it gets a value of the parameter's class type (or a derived class thereof), there is a way to copy if... even if there isn't. We now model this properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/copy-initialization.cpp')
-rw-r--r--test/SemaCXX/copy-initialization.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp
index e5b1fd766b..ea67e6ffe2 100644
--- a/test/SemaCXX/copy-initialization.cpp
+++ b/test/SemaCXX/copy-initialization.cpp
@@ -25,19 +25,17 @@ void test(const foo *P) { P->bar(); } // expected-error{{cannot initialize objec
namespace PR6757 {
struct Foo {
Foo();
- Foo(Foo&);
+ Foo(Foo&); // expected-note{{candidate constructor not viable}}
};
struct Bar {
operator const Foo&() const;
};
- void f(Foo); // expected-note{{candidate function not viable: no known conversion from 'PR6757::Bar' to 'PR6757::Foo' for 1st argument}}
+ void f(Foo);
- // FIXME: This isn't really the right reason for the failure. We
- // should fail after overload resolution.
void g(Foo foo) {
- f(Bar()); // expected-error{{no matching function for call to 'f'}}
+ f(Bar()); // expected-error{{no viable constructor copying parameter of type 'PR6757::Foo const'}}
f(foo);
}
}