Improve fix: #20867 ICE on final switch forward referencing its enum. (#21097)

* Mark C enums as semantic2done to prevent segfaults in final switch

* Added corresponding test case
This commit is contained in:
Abul Hossain Khan 2025-03-28 14:43:12 +05:30 committed by GitHub
parent 21cfefc9d1
commit 228f8dbcea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 1 deletions

View file

@ -751,6 +751,8 @@ void cEnumSemantic(Scope* sc, EnumDeclaration ed)
}
ed.memtype = commonType;
ed.semanticRun = PASS.semanticdone;
// Set semantic2done to mark C enums as fully processed
// Prevents issues with final switch statements that reference C enums
ed.semanticRun = PASS.semantic2done;
return;
}