Make shared static this() encoding table compilable

Basile B. b2.temp at
Mon Mar 14 10:07:52 UTC 2022

On Monday, 14 March 2022 at 09:40:00 UTC, zhad3 wrote:
> Hey everyone, I am in need of some help. I have written this 
> Windows CP949 encoding table 
> which is used to convert CP949 to UTF-16.
> After some research about how to initialize immutable 
> associative arrays people suggested using `shared static 
> this()`. So far this worked for me, but I recently discovered 
> that DMD cannot compile this in release mode with optimizations.
> `dub build --build=release`  or `dmd` with `-release -O` fails:
> ```
> code      windows949
> function  
> zencoding.windows949.fromWindows949!(immutable(ubyte)[]).fromWindows949
> code      table
> function  zencoding.windows949.table._sharedStaticCtor_L29_C1
> dmd failed with exit code -11.
> ```

That's a compiler bug of type "ICE", the compiler crashes.
Try reducing to a simple module that does not use phobos and 
report to bugzilla.

More information about the Digitalmars-d-learn mailing list