mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 18:11:19 +00:00
[Sema] Diagnose references to unbound arrays in function definitions
A [*] is only allowed in a declaration for a function, not in its definition. We didn't correctly recurse on reference types while looking for it, causing us to crash in CodeGen instead of rejecting it. llvm-svn: 234528
This commit is contained in:
parent
bba0eaae07
commit
df8f73fd8a
@ -7713,6 +7713,10 @@ static void diagnoseArrayStarInParamType(Sema &S, QualType PType,
|
||||
diagnoseArrayStarInParamType(S, PointerTy->getPointeeType(), Loc);
|
||||
return;
|
||||
}
|
||||
if (const auto *ReferenceTy = dyn_cast<ReferenceType>(PType)) {
|
||||
diagnoseArrayStarInParamType(S, ReferenceTy->getPointeeType(), Loc);
|
||||
return;
|
||||
}
|
||||
if (const auto *ParenTy = dyn_cast<ParenType>(PType)) {
|
||||
diagnoseArrayStarInParamType(S, ParenTy->getInnerType(), Loc);
|
||||
return;
|
||||
|
@ -17,3 +17,6 @@ namespace PR18581 {
|
||||
incomplete c[n]; // expected-error {{incomplete}}
|
||||
}
|
||||
}
|
||||
|
||||
void pr23151(int (&)[*]) { // expected-error {{variable length array must be bound in function definition}}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user