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:
- The optimizer does some lowering or similar and chooses a different code path not used in debug builds.
- 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