diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-11-03 17:00:07 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-11-03 17:00:07 +0000 |
commit | b37c9af75dae45b1a29909ff95511b5fe678edf1 (patch) | |
tree | 19be2789c0eebb4316b6defb3c8ea5f460febc85 /clang/test/SemaCXX/overloaded-builtin-operators.cpp | |
parent | 7d0ac84abdba5d47b54e72ae3f95a4507782f263 (diff) | |
download | bcm5719-llvm-b37c9af75dae45b1a29909ff95511b5fe678edf1.tar.gz bcm5719-llvm-b37c9af75dae45b1a29909ff95511b5fe678edf1.zip |
When producing overload candidates for binary built-in operators, keep
the sets of available conversions for the first and second arguments
separate. This is apparently the indent of C++ [over.built], and
reduces the number of overload candidates generated, eliminating some
ambiguities. Fixes PR8477.
llvm-svn: 118178
Diffstat (limited to 'clang/test/SemaCXX/overloaded-builtin-operators.cpp')
-rw-r--r-- | clang/test/SemaCXX/overloaded-builtin-operators.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/overloaded-builtin-operators.cpp b/clang/test/SemaCXX/overloaded-builtin-operators.cpp index 8a49671f1ab..382f5d973ba 100644 --- a/clang/test/SemaCXX/overloaded-builtin-operators.cpp +++ b/clang/test/SemaCXX/overloaded-builtin-operators.cpp @@ -200,3 +200,23 @@ namespace PR7319 { if (e1 > e2) {} } } + +namespace PR8477 { + struct Foo { + operator bool(); + operator const char *(); + }; + + bool doit() { + Foo foo; + long long zero = 0; + (void)(foo + zero); + (void)(foo - zero); + (void)(zero + foo); + (void)(zero[foo]); + (void)(foo - foo); // expected-error{{use of overloaded operator '-' is ambiguous}} \ + // expected-note 4{{built-in candidate operator-}} \ + // expected-note{{candidates omitted}} + return foo[zero] == zero; + } +} |