mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 13:16:46 +00:00
[Clang] Do not try to diagnose parameter packs in invalid pack expressions (#89257)
In a pack expression, if the id-expression is not valid, do no try to detect whether it is a pack as that would lead to a crash trying to print a recovery expression. Fixes #88929
This commit is contained in:
parent
e32c4dfefc
commit
aa22d4422e
@ -1085,9 +1085,11 @@ ExprResult Sema::ActOnPackIndexingExpr(Scope *S, Expr *PackExpression,
|
||||
SourceLocation RSquareLoc) {
|
||||
bool isParameterPack = ::isParameterPack(PackExpression);
|
||||
if (!isParameterPack) {
|
||||
CorrectDelayedTyposInExpr(IndexExpr);
|
||||
Diag(PackExpression->getBeginLoc(), diag::err_expected_name_of_pack)
|
||||
<< PackExpression;
|
||||
if (!PackExpression->containsErrors()) {
|
||||
CorrectDelayedTyposInExpr(IndexExpr);
|
||||
Diag(PackExpression->getBeginLoc(), diag::err_expected_name_of_pack)
|
||||
<< PackExpression;
|
||||
}
|
||||
return ExprError();
|
||||
}
|
||||
ExprResult Res =
|
||||
|
@ -154,3 +154,9 @@ void f() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace GH88929 {
|
||||
bool b = a...[0]; // expected-error {{use of undeclared identifier 'a'}}
|
||||
using E = P...[0]; // expected-error {{unknown type name 'P'}} \
|
||||
// expected-error {{expected ';' after alias declaration}}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user