зеркало из https://github.com/microsoft/clang-1.git
PR13098: If we're instantiating an overloaded binary operator and we could
determine which member function would be the callee from within the template definition, don't pass that function as a "non-member function" to CreateOverloadedBinOp. Instead, just rely on it to select the member function for itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168818 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
2cbdd7d21e
Коммит
f641166066
|
@ -9180,7 +9180,12 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
|
|||
// IsAcceptableNonMemberOperatorCandidate for each of these?
|
||||
Functions.append(ULE->decls_begin(), ULE->decls_end());
|
||||
} else {
|
||||
Functions.addDecl(cast<DeclRefExpr>(Callee)->getDecl());
|
||||
// If we've resolved this to a particular non-member function, just call
|
||||
// that function. If we resolved it to a member function,
|
||||
// CreateOverloaded* will find that function for us.
|
||||
NamedDecl *ND = cast<DeclRefExpr>(Callee)->getDecl();
|
||||
if (!isa<CXXMethodDecl>(ND))
|
||||
Functions.addDecl(ND);
|
||||
}
|
||||
|
||||
// Add any functions found via argument-dependent lookup.
|
||||
|
|
|
@ -27,3 +27,25 @@ template<typename T> struct X {
|
|||
static T f(bool);
|
||||
};
|
||||
void (*p)() = &X<void>().f; // expected-note {{instantiation of}}
|
||||
|
||||
namespace PR13098 {
|
||||
struct A {
|
||||
A(int);
|
||||
void operator++() {}
|
||||
void operator+(int) {}
|
||||
void operator+(A) {}
|
||||
void operator[](int) {}
|
||||
void operator[](A) {}
|
||||
};
|
||||
struct B : A {
|
||||
using A::operator++;
|
||||
using A::operator+;
|
||||
using A::operator[];
|
||||
};
|
||||
template<typename T> void f(B b) {
|
||||
++b;
|
||||
b + 0;
|
||||
b[0];
|
||||
}
|
||||
template void f<void>(B);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче