diff options
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index bda80cd205..c7ea55219a 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1883,6 +1883,17 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, } } R.addDecl(ND); + if (getLangOpts().CPlusPlus && ND->isCXXClassMember()) { + CXXRecordDecl *Record = nullptr; + if (Corrected.getCorrectionSpecifier()) { + const Type *Ty = Corrected.getCorrectionSpecifier()->getAsType(); + Record = Ty->getAsCXXRecordDecl(); + } + if (!Record) + Record = cast<CXXRecordDecl>( + ND->getDeclContext()->getRedeclContext()); + R.setNamingClass(Record); + } AcceptableWithRecovery = isa<ValueDecl>(ND) || isa<FunctionTemplateDecl>(ND); @@ -2100,6 +2111,9 @@ ExprResult Sema::ActOnIdExpression(Scope *S, // If this name wasn't predeclared and if this is not a function // call, diagnose the problem. CorrectionCandidateCallback DefaultValidator; + DefaultValidator.IsAddressOfOperand = IsAddressOfOperand; + assert((!CCC || CCC->IsAddressOfOperand == IsAddressOfOperand) && + "Typo correction callback misconfigured"); if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator)) return ExprError(); |