dmd/compiler/test/fail_compilation/fix20867.d
Abul Hossain Khan dafb58bc77
Fix: Prevent ICE on final switch forward referencing its enum (#21001)
* Fix: Prevent ICE on final switch forward referencing its enum

* more simpler approach

* moved the enum member analysis

* Move enum number analysis to sementic2

* WhiteSpace Remove

* Remove Redundant Code in enumsem
2025-03-20 16:43:37 +01:00

20 lines
361 B
D

/*
TEST_OUTPUT:
---
fail_compilation/fix20867.d(14): Error: cannot use `final switch` on enum `E` while it is being defined
---
*/
// Test case from Issue #20867
enum E
{
a = 3,
b = () {
E e;
final switch (e) // This should error out instead of segfaulting
{
case E.a: break;
}
return 4;
} ()
}