diff options
author | John McCall <rjmccall@apple.com> | 2010-01-13 22:30:33 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-01-13 22:30:33 +0000 |
commit | cefd3ada97faf5a759dac4705900053d3aa071e9 (patch) | |
tree | 5e98e47b6952e5feff3e9df71237d3f28f9bc0de | |
parent | 64f7e258e9c43eefb7f82dfcd600abeed48dc395 (diff) |
Don't report ambiguities in the user-defined conversion if we weren't supposed
to be considering user-defined conversions in the first place.
Doug, please review; I'm not sure what we should be doing if we see a real
ambiguity in selecting a copy constructor when otherwise suppressing
user-defined conversions.
Fixes PR6014.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93365 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/overload-call.cpp | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index ffcf8d4609..5abca99896 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -493,7 +493,7 @@ Sema::TryImplicitConversion(Expr* From, QualType ToType, ICS.setBad(); ICS.Bad.init(BadConversionSequence::suppressed_user, From, ToType); } - } else if (UserDefResult == OR_Ambiguous) { + } else if (UserDefResult == OR_Ambiguous && !SuppressUserConversions) { ICS.setAmbiguous(); ICS.Ambiguous.setFromType(From->getType()); ICS.Ambiguous.setToType(ToType); diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp index 0a2508d4b8..acd1e50afe 100644 --- a/test/SemaCXX/overload-call.cpp +++ b/test/SemaCXX/overload-call.cpp @@ -317,3 +317,19 @@ namespace test1 { } } +// PR 6014 +namespace test2 { + struct QFixed { + QFixed(int i); + QFixed(long i); + }; + + bool operator==(const QFixed &f, int i); + + class qrgb666 { + inline operator unsigned int () const; + + inline bool operator==(const qrgb666 &v) const; + inline bool operator!=(const qrgb666 &v) const { return !(*this == v); } + }; +} |