Created attachment 1084 [details] repro case When using a mixin template, which uses a module thats imported with a public import, the order the module destructors are called is wrong. The destructor of the module that is used by the mixin template gets called before the destructor of the module that uses the mixin template. Therefore the module that uses the mixin template works on a already destructed version of the module. See attached repro case. Tested with dmd 2.058
You mixed "static shared this()" into a class. As shared and static are not applicable for a constructor they are ignored (see #3118). A module constructor needs to be "shared static this()"