]> granicus.if.org Git - clang/commitdiff
A built-in overload candidate is consider a non-template function when
authorDouglas Gregor <dgregor@apple.com>
Tue, 8 Jun 2010 21:03:17 +0000 (21:03 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 8 Jun 2010 21:03:17 +0000 (21:03 +0000)
determining whether one overload candidate is better than
another. Fixes PR7319.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105642 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/SemaCXX/overloaded-builtin-operators.cpp

index 6a020d57d3778ac86f6d740a007f319fbe953cfc..d746ec3f6dc5c79e07a8f938d9fef98a1c2edd37 100644 (file)
@@ -4955,7 +4955,7 @@ Sema::isBetterOverloadCandidate(const OverloadCandidate& Cand1,
 
   //     - 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;
 
index 61c2e2110a99652ba2394bef71f761e82bc3e747..1ba945246663aea235990e64ae4229c873dd886b 100644 (file)
@@ -188,3 +188,14 @@ int test_pr5432() {
 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) {}
+  }
+}