Skip to content

Commit 8b3cb4e

Browse files
committed
Mark C enums as semantic2done to prevent segfaults in final switch
1 parent 001893d commit 8b3cb4e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dmd/importc.d

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,8 @@ void cEnumSemantic(Scope* sc, EnumDeclaration ed)
751751
}
752752

753753
ed.memtype = commonType;
754-
ed.semanticRun = PASS.semanticdone;
754+
// Set semantic2done to mark C enums as fully processed
755+
// Prevents issues with final switch statements that reference C enums
756+
ed.semanticRun = PASS.semantic2done;
755757
return;
756758
}

0 commit comments

Comments
 (0)