DMD64 2.095.1 unresolved _D4core8internal7switch___T14__switch_error in optimized build only

x3g6h7k8 email at notworking.qrk
Fri Apr 9 14:59:16 UTC 2021


On Friday, 9 April 2021 at 12:41:02 UTC, MoonlightSentinel wrote:
> On Friday, 9 April 2021 at 11:36:21 UTC, x3g6h7k8 wrote:
>> The interesting point is this happens only in optimized 
>> builds. In debug builds everything is fine.
>
> Looks like DMD skips the codegen for this template instance 
> because it erroneously assumes that the template is already 
> emitted in another object file.
> This decision is probably affected by some code in a `debug`  
> statement which makes it work when compiling with `-debug`.
>
> You can try to compile the release version with `-allinst`.

After posting my message I found this one by chance:
https://forum.dlang.org/post/lixbkcxtalzplziwbssq@forum.dlang.org

It seems to be a different problem but has the same missing 
symbol (among others). So I tried the given solution there, doing 
a clean slate, removing project .dub/ and home dub/. This changed 
nothing on my side.

Thereafter I removed the __"inline"__ from the regular dub 
release buildOptions. With this change an executable was created.

Then I saw your reply. So far I can see there is no `debug` 
statement in my own code. However could it be that `unittest` 
blocks could trigger a similar behavior?

An observation I made now was that compiling unit tests with 
__["optimize", "inline"]__ in an extra buildType were working 
fine too.

Lastly I tried your suggestion with `-allinst`. This made no 
difference, same linking error.

So for the time being I will stick to not using __"inline"__, 
this should be not a big problem.

Thank you very much for your input to this problem.


More information about the Digitalmars-d-learn mailing list