PR43242: Fix crash when typo-correcting to an operator() that should not

have been visible.

llvm-svn: 371468
This commit is contained in:
Richard Smith 2019-09-09 23:07:22 +00:00
parent 06c8cb03ca
commit 245ba2c25f
2 changed files with 5 additions and 10 deletions

View File

@ -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<FunctionDecl>(DC) &&
cast<FunctionDecl>(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.

View File

@ -630,3 +630,7 @@ void Run(const int& points) {
};
}
}
void operator_parens() {
[&](int x){ operator()(); }(0); // expected-error {{undeclared 'operator()'}}
}