diff options
| author | John McCall <rjmccall@apple.com> | 2010-06-16 08:42:20 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-06-16 08:42:20 +0000 |
| commit | e9cccd86da2fe29b7488e4888fa09c6834c82f31 (patch) | |
| tree | 5a7b17c3fc2c082838d3ecae813af472a552eab5 /clang/lib/Sema/SemaDecl.cpp | |
| parent | f128bdcb557e20b20d02ca0351aa4ff19a1b0c42 (diff) | |
| download | bcm5719-llvm-e9cccd86da2fe29b7488e4888fa09c6834c82f31.tar.gz bcm5719-llvm-e9cccd86da2fe29b7488e4888fa09c6834c82f31.zip | |
Fix a point of semantics with using declaration hiding: method templates
introduced by using decls are hidden even if their template parameter lists
or return types differ from the "overriding" declaration.
Propagate using shadow declarations around more effectively when looking up
template-ids. Reperform lookup for template-ids in member expressions so that
access control is properly set up.
Fix some number of latent bugs involving template-ids with totally invalid
base types. You can only actually get these with a scope specifier, since
otherwise the template-id won't parse as a template-id.
Fixes PR7384.
llvm-svn: 106093
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 813fc6cd3c2..ddc5ef108a8 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2863,7 +2863,7 @@ static bool FindOverriddenMethod(const CXXBaseSpecifier *Specifier, // FIXME: Do we care about other names here too? if (Name.getNameKind() == DeclarationName::CXXDestructorName) { - // We really want to find the base class constructor here. + // We really want to find the base class destructor here. QualType T = Data->S->Context.getTypeDeclType(BaseRecord); CanQualType CT = Data->S->Context.getCanonicalType(T); @@ -2873,8 +2873,9 @@ static bool FindOverriddenMethod(const CXXBaseSpecifier *Specifier, for (Path.Decls = BaseRecord->lookup(Name); Path.Decls.first != Path.Decls.second; ++Path.Decls.first) { - if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(*Path.Decls.first)) { - if (MD->isVirtual() && !Data->S->IsOverload(Data->Method, MD)) + NamedDecl *D = (*Path.Decls.first)->getUnderlyingDecl(); + if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { + if (MD->isVirtual() && !Data->S->IsOverload(Data->Method, MD, false)) return true; } } @@ -3588,13 +3589,10 @@ void Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, } } - switch (CheckOverload(NewFD, Previous, OldDecl)) { + switch (CheckOverload(S, NewFD, Previous, OldDecl, + /*NewIsUsingDecl*/ false)) { case Ovl_Match: Redeclaration = true; - if (isa<UsingShadowDecl>(OldDecl) && CurContext->isRecord()) { - HideUsingShadowDecl(S, cast<UsingShadowDecl>(OldDecl)); - Redeclaration = false; - } break; case Ovl_NonFunction: |

