[cfe-commits] r105642 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/overloaded-builtin-operators.cpp
Douglas Gregor
dgregor at apple.com
Tue Jun 8 14:03:17 PDT 2010
Author: dgregor
Date: Tue Jun 8 16:03:17 2010
New Revision: 105642
URL: http://llvm.org/viewvc/llvm-project?rev=105642&view=rev
Log:
A built-in overload candidate is consider a non-template function when
determining whether one overload candidate is better than
another. Fixes PR7319.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=105642&r1=105641&r2=105642&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Jun 8 16:03:17 2010
@@ -4955,7 +4955,7 @@
// - F1 is a non-template function and F2 is a function template
// specialization, or, if not that,
- if (Cand1.Function && !Cand1.Function->getPrimaryTemplate() &&
+ if ((!Cand1.Function || !Cand1.Function->getPrimaryTemplate()) &&
Cand2.Function && Cand2.Function->getPrimaryTemplate())
return true;
Modified: cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp?rev=105642&r1=105641&r2=105642&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp (original)
+++ cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp Tue Jun 8 16:03:17 2010
@@ -188,3 +188,14 @@
void f() {
(void)__extension__(A());
}
+
+namespace PR7319 {
+ typedef enum { Enum1, Enum2, Enum3 } MyEnum;
+
+ template<typename X> bool operator>(const X &inX1, const X &inX2);
+
+ void f() {
+ MyEnum e1, e2;
+ if (e1 > e2) {}
+ }
+}
More information about the cfe-commits
mailing list