mirror of
https://github.com/intel/llvm.git
synced 2026-02-01 08:56:15 +08:00
Implement partial ordering of function templates when calling a
conversion function. llvm-svn: 81807
This commit is contained in:
@@ -3711,7 +3711,8 @@ Sema::isBetterOverloadCandidate(const OverloadCandidate& Cand1,
|
||||
if (FunctionTemplateDecl *BetterTemplate
|
||||
= getMoreSpecializedTemplate(Cand1.Function->getPrimaryTemplate(),
|
||||
Cand2.Function->getPrimaryTemplate(),
|
||||
TPOC_Call))
|
||||
isa<CXXConversionDecl>(Cand1.Function)? TPOC_Conversion
|
||||
: TPOC_Call))
|
||||
return BetterTemplate == Cand1.Function->getPrimaryTemplate();
|
||||
|
||||
// -- the context is an initialization by user-defined conversion
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// RUN: clang-cc -fsyntax-only -verify %s
|
||||
|
||||
template<typename T>
|
||||
int &f0(T);
|
||||
|
||||
@@ -84,3 +83,13 @@ void test_f6(int i, const int ic) {
|
||||
int &ir = f6(i, i);
|
||||
float &fr = f6(ic, ic);
|
||||
}
|
||||
|
||||
struct CrazyFun {
|
||||
template<typename T, typename U> operator A<T, U>();
|
||||
template<typename T> operator A<T, T>();
|
||||
};
|
||||
|
||||
void fun(CrazyFun cf) {
|
||||
A<int, float> aif = cf;
|
||||
A<int, int> aii = cf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user