When name lookup finds a single declaration that was imported via a

using declaration, look at its underlying declaration to determine the
lookup result kind (e.g., overloaded, unresolved). Fixes at least one
issue in Boost.Bimap.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102317 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2010-04-25 21:15:30 +00:00
Родитель b0fd483ad6
Коммит 2b147f072b
3 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -2834,6 +2834,7 @@ Sema::BuildMemberReferenceExpr(ExprArg Base, QualType BaseExprType,
Diag(MemberDecl->getLocation(), diag::note_member_declared_here)
<< MemberName;
R.suppressDiagnostics();
return ExprError();
}
@ -3514,7 +3515,8 @@ Sema::ActOnCallExpr(Scope *S, ExprArg fn, SourceLocation LParenLoc,
// declarations (all methods or method templates) or a single
// method template.
assert((MemE->getNumDecls() > 1) ||
isa<FunctionTemplateDecl>(*MemE->decls_begin()));
isa<FunctionTemplateDecl>(
(*MemE->decls_begin())->getUnderlyingDecl()));
(void)MemE;
return BuildCallToMemberFunction(S, Fn, LParenLoc, Args, NumArgs,

Просмотреть файл

@ -299,9 +299,10 @@ void LookupResult::resolveKind() {
// If there's a single decl, we need to examine it to decide what
// kind of lookup this is.
if (N == 1) {
if (isa<FunctionTemplateDecl>(*Decls.begin()))
NamedDecl *D = (*Decls.begin())->getUnderlyingDecl();
if (isa<FunctionTemplateDecl>(D))
ResultKind = FoundOverloaded;
else if (isa<UnresolvedUsingValueDecl>(*Decls.begin()))
else if (isa<UnresolvedUsingValueDecl>(D))
ResultKind = FoundUnresolvedValue;
return;
}

Просмотреть файл

@ -56,3 +56,19 @@ namespace test3 {
}
};
}
namespace test4 {
class X {
protected:
template<typename T> void f(T);
};
class Y : public X {
public:
using X::f;
};
void test_f(Y y) {
y.f(17);
}
}