Skip to content

Commit ce21919

Browse files
committed
A built-in overload candidate is consider a non-template function when
determining whether one overload candidate is better than another. Fixes PR7319. llvm-svn: 105642
1 parent 3b83618 commit ce21919

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clang/lib/Sema/SemaOverload.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4955,7 +4955,7 @@ Sema::isBetterOverloadCandidate(const OverloadCandidate& Cand1,
49554955

49564956
// - F1 is a non-template function and F2 is a function template
49574957
// specialization, or, if not that,
4958-
if (Cand1.Function && !Cand1.Function->getPrimaryTemplate() &&
4958+
if ((!Cand1.Function || !Cand1.Function->getPrimaryTemplate()) &&
49594959
Cand2.Function && Cand2.Function->getPrimaryTemplate())
49604960
return true;
49614961

clang/test/SemaCXX/overloaded-builtin-operators.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,14 @@ int test_pr5432() {
188188
void f() {
189189
(void)__extension__(A());
190190
}
191+
192+
namespace PR7319 {
193+
typedef enum { Enum1, Enum2, Enum3 } MyEnum;
194+
195+
template<typename X> bool operator>(const X &inX1, const X &inX2);
196+
197+
void f() {
198+
MyEnum e1, e2;
199+
if (e1 > e2) {}
200+
}
201+
}

0 commit comments

Comments
 (0)