diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-08-14 23:34:52 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-08-14 23:34:52 +0000 |
commit | 99af5d60f1c51b67547fb82056221f2dd7f88aaa (patch) | |
tree | 8dafeefe81e15d0e8411ecece9912ded93832bab /lib/Sema/SemaCXXScopeSpec.cpp | |
parent | 8e928eb5560c6ca902624a045700fa99970973b8 (diff) |
Limit our MSVC compat hack for nested names from dependent bases
Previously, any undeclared unqualified id starting a nested name
specifier in a dependent context would have its lookup retried during
template instantiation. Now we limit that retry hack to methods of a
class with dependent bases. Free function templates in particular are
no longer affected by this hack.
Also, diagnose this as a Microsoft extension. This has the downside that
template authors may see this warning *and* an error during
instantiation time about this identifier. Fixing that will probably
require formalizing some kind of "delayed" identifier, instead of our
ad-hoc solutions of forming dependent AST nodes when lookup fails.
Based on a patch by Kim Gräsman!
Differential Revision: http://reviews.llvm.org/D4854
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215683 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r-- | lib/Sema/SemaCXXScopeSpec.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index a70aca2ad8..b1b8b5d1dc 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -703,8 +703,13 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, if (getLangOpts().MSVCCompat) { DeclContext *DC = LookupCtx ? LookupCtx : CurContext; if (DC->isDependentContext() && DC->isFunctionOrMethod()) { - SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc); - return false; + CXXRecordDecl *ContainingClass = dyn_cast<CXXRecordDecl>(DC->getParent()); + if (ContainingClass && ContainingClass->hasAnyDependentBases()) { + Diag(IdentifierLoc, diag::ext_undeclared_unqual_id_with_dependent_base) + << &Identifier << ContainingClass; + SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc); + return false; + } } } |