[Issue 20520] Runtime segfault when taking typeid of a class instanciated within an enum

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 3 11:02:51 UTC 2023


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

Iain Buclaw <ibuclaw at gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at gdcproject.org

--- Comment #6 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to Walter Bright from comment #5)
> Razvan is right. This should not compile. An enum's value should evaluate to
> a constant, not a pointer to the heap.
> 
> Just like this does not compile:
> 
>     class C { }
>     C x = new C();
It's an rodata constant, you support it in the same way that

   static C x = new C();

is supported.

--


More information about the Digitalmars-d-bugs mailing list