summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-04-29 08:45:27 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-04-29 08:45:27 +0000
commita3519fa3474621dddaa7644eb814d4acc33c6d78 (patch)
treecd0562e93ae7ebadc9f501f3a74a8b818df28d7e /clang/lib/Sema/SemaExpr.cpp
parent03cf3c89662c9da3fa25fcfc10aa3c0cfd1d23c2 (diff)
downloadbcm5719-llvm-a3519fa3474621dddaa7644eb814d4acc33c6d78.tar.gz
bcm5719-llvm-a3519fa3474621dddaa7644eb814d4acc33c6d78.zip
Fix an assertion failure / accepts-invalid in -fms-extensions mode. Don't build
a dependent-scope id expression when a templated member function of a non-templated class references an unknown identifier, since instantiation won't rebuild it (and we can tell at parse time that it'll never work). Based on a patch by Faisal Vali! llvm-svn: 180701
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index a0e6c2144eb..f5900c06c79 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1916,15 +1916,17 @@ ExprResult Sema::ActOnIdExpression(Scope *S,
// If this name wasn't predeclared and if this is not a function
// call, diagnose the problem.
if (R.empty()) {
-
// In Microsoft mode, if we are inside a template class member function
- // and we can't resolve an identifier then assume the identifier is type
- // dependent. The goal is to postpone name lookup to instantiation time
- // to be able to search into type dependent base classes.
- if (getLangOpts().MicrosoftMode && CurContext->isDependentContext() &&
- isa<CXXMethodDecl>(CurContext))
- return ActOnDependentIdExpression(SS, TemplateKWLoc, NameInfo,
- IsAddressOfOperand, TemplateArgs);
+ // whose parent class has dependent base classes, and we can't resolve
+ // an identifier, then assume the identifier is type dependent. The
+ // goal is to postpone name lookup to instantiation time to be able to
+ // search into the type dependent base classes.
+ if (getLangOpts().MicrosoftMode) {
+ CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CurContext);
+ if (MD && MD->getParent()->hasAnyDependentBases())
+ return ActOnDependentIdExpression(SS, TemplateKWLoc, NameInfo,
+ IsAddressOfOperand, TemplateArgs);
+ }
CorrectionCandidateCallback DefaultValidator;
if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator))
OpenPOWER on IntegriCloud