[clang] Ignore DependentSizeArray in -Warray-parameter

Acknowledge we don't know how to handle those yet.
This commit is contained in:
serge-sans-paille 2022-07-13 14:53:04 +02:00
parent 04419a5f55
commit 66fa2847a7
2 changed files with 14 additions and 1 deletions

View File

@ -3241,9 +3241,15 @@ static bool EquivalentArrayTypes(QualType Old, QualType New,
}
// Only compare size, ignore Size modifiers and CVR.
if (Old->isConstantArrayType() && New->isConstantArrayType())
if (Old->isConstantArrayType() && New->isConstantArrayType()) {
return Ctx.getAsConstantArrayType(Old)->getSize() ==
Ctx.getAsConstantArrayType(New)->getSize();
}
// Don't try to compare dependent sized array
if (Old->isDependentSizedArrayType() && New->isDependentSizedArrayType()) {
return true;
}
return Old == New;
}

View File

@ -16,3 +16,10 @@ void func<10>(int (&Val)[10]) {
static constexpr int Extent = 10;
void funk(int i[10]);
void funk(int i[Extent]); // no-warning
template<int K>
struct T {
static void F(int a[8 * K]);
};
template<int K>
void T<K>::F(int a[8 * K]) {} // no-warning