[Issue 23310] Segfault on switch with global enum

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 29 19:52:14 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=23310

--- Comment #4 from Dennis <dkorpel at live.nl> ---
(In reply to ryuukk_ from comment #3)
> It should provide an error:
> 
> ```
> `switch` runtime hook not found
> Have you created a custom `object` module and forgot to implement the hook?
> ```

I still cannot reproduce (on linux), and I don't get why you would expect a
runtime hook for a switch statement over an integer. If I adapt your example to
use final switch:

```
enum Test {A, B, C}

Test test = Test.A;

extern(C) void main()
{
    final switch(test)
    {
        case Test.A:
        case Test.B:
        case Test.C:
    }
}
```

I get:

test_.d(7): Error: `object.__switch_error` not found. The current runtime does
not support generating assert messages, or the runtime is corrupt.

Which looks like what you want.

Are you sure the segfault is because of the switch, or could it have to do with
thread local storage not being initialized on Windows without druntime?

--


More information about the Digitalmars-d-bugs mailing list