forked from OSchip/llvm-project
Much to my surprise, OverloadExprs can also point to function template decls.
llvm-svn: 127061
This commit is contained in:
parent
6f9a8f85d7
commit
f8bb45f14d
|
@ -4017,21 +4017,24 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
|
|||
bool HasViableZeroArgOverload = false;
|
||||
for (OverloadExpr::decls_iterator it = AllOverloads.begin(),
|
||||
DeclsEnd = AllOverloads.end(); it != DeclsEnd; ++it) {
|
||||
const FunctionDecl *OverloadDecl = cast<FunctionDecl>(*it);
|
||||
QualType ResultTy = OverloadDecl->getResultType();
|
||||
if ((!IsArrow && ResultTy->isRecordType()) ||
|
||||
(IsArrow && ResultTy->isPointerType() &&
|
||||
ResultTy->getPointeeType()->isRecordType())) {
|
||||
ViableOverloads.addDecl(*it);
|
||||
if (OverloadDecl->getMinRequiredArguments() == 0) {
|
||||
HasViableZeroArgOverload = true;
|
||||
// Our overload set may include TemplateDecls, which we'll ignore for the
|
||||
// purposes of determining whether we can issue a '()' fixit.
|
||||
if (const FunctionDecl *OverloadDecl = dyn_cast<FunctionDecl>(*it)) {
|
||||
QualType ResultTy = OverloadDecl->getResultType();
|
||||
if ((!IsArrow && ResultTy->isRecordType()) ||
|
||||
(IsArrow && ResultTy->isPointerType() &&
|
||||
ResultTy->getPointeeType()->isRecordType())) {
|
||||
ViableOverloads.addDecl(*it);
|
||||
if (OverloadDecl->getMinRequiredArguments() == 0) {
|
||||
HasViableZeroArgOverload = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!HasViableZeroArgOverload || ViableOverloads.size() != 1) {
|
||||
Diag(BaseExpr->getExprLoc(), diag::err_member_reference_needs_call)
|
||||
<< 1 << 0
|
||||
<< (AllOverloads.size() > 1) << 0
|
||||
<< BaseExpr->getSourceRange();
|
||||
int ViableOverloadCount = ViableOverloads.size();
|
||||
int I;
|
||||
|
|
|
@ -135,4 +135,9 @@ namespace PR9025 {
|
|||
int g3() {
|
||||
return fun3.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it with no arguments?}}
|
||||
}
|
||||
|
||||
template <typename T> S fun4();
|
||||
int g4() {
|
||||
return fun4.x; // expected-error{{base of member reference is a function; perhaps you meant to call it?}}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue