DMD64 2.095.1 unresolved _D4core8internal7switch___T14__switch_error in optimized build only

x3g6h7k8 email at notworking.qrk
Fri Apr 9 11:36:21 UTC 2021


Working on a project with some dozen source files and an external 
dependency on botan building with integrated dub.
There is only minimal templating used on my side.
Using DMD 64bit 2.095.1 I get the following error:

```
app_win_dmd_a64_rel.obj : error LNK2019: unresolved external 
symbol 
_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv 
referenced in function 
_D3std3uni__T21genericDecodeGraphemeVbi0Z__TQBfTAxwZQBnFNaNbNiNfKQrZv

.dub\build\mainapp_win_dmd_a64_rel-release-windows-x86_64-dmd_v2.095.1-dirty-76A12175597E4044EE0E049BBF1AC35D\app_win_dmd_a64_rel.exe : fatal error LNK1120: 1 unresolved externals
```

The interesting point is this happens only in optimized builds. 
In debug builds everything is fine.
It happens both with Windows DMD64 and Linux DMD64.


Dub compile options in debug:
```
dmd -m64 -c -of.dub\build\app_win_dmd_...\app_win_dmd_a64_dbg.obj 
-debug -g -wi -de ...
```

Dub compile options in optimized:
```
dmd -m64 -c -of.dub\build\app_win_dmd_...\app_win_dmd_a64_rel.obj 
-inline -O -wi -de ...
```


template genericDecodeGrapheme(bool getValue) seems to sit in
   dmd2\src\phobos\std\uni\package.d
and has a switch in it.

What's going on here?

I could imagine the following:
1) The optimizer does some lowering or similar and chooses a 
different code path not used in debug builds.
2) Something is different with name mangling in debug/optimized 
builds.

Is this a known problem already? Didn't found something about it.
Anyone with an idea how to cope with it?

Currently I don't have a reduced test case for this and may not 
be able to create one shortly.


Thanks


More information about the Digitalmars-d-learn mailing list