[cfe-commits] r93365 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/overload-call.cpp
John McCall
rjmccall at apple.com
Wed Jan 13 14:30:33 PST 2010
Author: rjmccall
Date: Wed Jan 13 16:30:33 2010
New Revision: 93365
URL: http://llvm.org/viewvc/llvm-project?rev=93365&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaCXX/overload-call.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=93365&r1=93364&r2=93365&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Jan 13 16:30:33 2010
@@ -493,7 +493,7 @@
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);
Modified: cfe/trunk/test/SemaCXX/overload-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call.cpp?rev=93365&r1=93364&r2=93365&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-call.cpp Wed Jan 13 16:30:33 2010
@@ -317,3 +317,19 @@
}
}
+// 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); }
+ };
+}
More information about the cfe-commits
mailing list