Fix detecting multiple pattern defaults

This commit is contained in:
Wilson Snyder 2022-12-29 20:16:30 -05:00
parent 24198ef0ed
commit 9255707dd4

View File

@ -3732,13 +3732,14 @@ private:
}
}
AstPatMember* defaultp = nullptr;
for (AstPatMember* patp = VN_AS(nodep->itemsp(), PatMember); patp;
patp = VN_AS(patp->nextp(), PatMember)) {
for (AstPatMember* patp = VN_AS(nodep->itemsp(), PatMember); patp;) {
AstPatMember* const nextp = VN_AS(patp->nextp(), PatMember);
if (patp->isDefault()) {
if (defaultp) nodep->v3error("Multiple '{ default: } clauses");
defaultp = patp;
patp->unlinkFrBack();
}
patp = nextp;
}
while (const AstConstDType* const vdtypep = VN_CAST(dtypep, ConstDType)) {
dtypep = vdtypep->subDTypep()->skipRefp();