summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/conditional-expr.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-01-12 00:44:57 +0000
committerJohn McCall <rjmccall@apple.com>2010-01-12 00:44:57 +0000
commit0d1da2298aaa8a01e7672cba6f4f2151640b5552 (patch)
tree3905bfcca99e5a4a48d53dec57244dec3f6c2495 /clang/test/SemaCXX/conditional-expr.cpp
parent87be3617e3bf6ce34a417d9064649f4b315177a7 (diff)
downloadbcm5719-llvm-0d1da2298aaa8a01e7672cba6f4f2151640b5552.tar.gz
bcm5719-llvm-0d1da2298aaa8a01e7672cba6f4f2151640b5552.zip
Introduce a specific representation for the ambiguous implicit conversion
sequence. Lots of small relevant changes. Fixes some serious problems with ambiguous conversions; also possibly improves associated diagnostics. llvm-svn: 93214
Diffstat (limited to 'clang/test/SemaCXX/conditional-expr.cpp')
-rw-r--r--clang/test/SemaCXX/conditional-expr.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/test/SemaCXX/conditional-expr.cpp b/clang/test/SemaCXX/conditional-expr.cpp
index 0617cd5702c..8eaff784da6 100644
--- a/clang/test/SemaCXX/conditional-expr.cpp
+++ b/clang/test/SemaCXX/conditional-expr.cpp
@@ -7,8 +7,8 @@
struct ToBool { explicit operator bool(); };
struct B;
-struct A { A(); A(const B&); };
-struct B { operator A() const; };
+struct A { A(); A(const B&); }; // expected-note 2 {{candidate constructor}}
+struct B { operator A() const; }; // expected-note 2 {{candidate function}}
struct I { operator int(); };
struct J { operator I(); };
struct K { operator double(); };
@@ -50,8 +50,8 @@ struct MixedFieldsDerived : MixedFields {
enum Enum { EVal };
struct Ambig {
- operator short();
- operator signed char();
+ operator short(); // expected-note 2 {{candidate function}}
+ operator signed char(); // expected-note 2 {{candidate function}}
};
void test()
@@ -129,10 +129,10 @@ void test()
vfn pfn = i1 ? F() : test;
pfn = i1 ? test : F();
// these are ambiguous - better messages would be nice
- (void)(i1 ? A() : B()); // expected-error {{incompatible operand types}}
- (void)(i1 ? B() : A()); // expected-error {{incompatible operand types}}
- (void)(i1 ? 1 : Ambig()); // expected-error {{incompatible operand types}}
- (void)(i1 ? Ambig() : 1); // expected-error {{incompatible operand types}}
+ (void)(i1 ? A() : B()); // expected-error {{conversion from 'struct B' to 'struct A' is ambiguous}}
+ (void)(i1 ? B() : A()); // expected-error {{conversion from 'struct B' to 'struct A' is ambiguous}}
+ (void)(i1 ? 1 : Ambig()); // expected-error {{conversion from 'struct Ambig' to 'int' is ambiguous}}
+ (void)(i1 ? Ambig() : 1); // expected-error {{conversion from 'struct Ambig' to 'int' is ambiguous}}
// By the way, this isn't an lvalue:
&(i1 ? i1 : i2); // expected-error {{address expression must be an lvalue or a function designator}}
OpenPOWER on IntegriCloud