From: Richard Smith Date: Mon, 9 Sep 2019 23:07:22 +0000 (+0000) Subject: PR43242: Fix crash when typo-correcting to an operator() that should not X-Git-Tag: llvmorg-11-init~9610 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=245ba2c25fef704abe8caa662c02b147eab12eac;p=platform%2Fupstream%2Fllvm.git PR43242: Fix crash when typo-correcting to an operator() that should not have been visible. llvm-svn: 371468 --- diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 816d37e..98f98be 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1990,16 +1990,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, R.clear(); } - // In Microsoft mode, if we are performing lookup from within a friend - // function definition declared at class scope then we must set - // DC to the lexical parent to be able to search into the parent - // class. - if (getLangOpts().MSVCCompat && isa(DC) && - cast(DC)->getFriendObjectKind() && - DC->getLexicalParent()->isRecord()) - DC = DC->getLexicalParent(); - else - DC = DC->getParent(); + DC = DC->getLookupParent(); } // We didn't find anything, so try to correct for a typo. diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp index 311def9..5fff855 100644 --- a/clang/test/SemaCXX/lambda-expressions.cpp +++ b/clang/test/SemaCXX/lambda-expressions.cpp @@ -630,3 +630,7 @@ void Run(const int& points) { }; } } + +void operator_parens() { + [&](int x){ operator()(); }(0); // expected-error {{undeclared 'operator()'}} +}