[BUG] Explicit instantiations crash Visual Studio 2017 linker in debug
Environment
Windows 10 OpenVDB v9.0.0 Visual Studio 2017, exact compiler version 14.16.27048.0
Describe the bug
Turning on USE_EXPLICIT_INSTANTIATIONS in CMake debug mode causes a fatal error in the VS2017 linker with the following error:
VolumeToMesh.obj: fatal error LNK1000: Internal error during BuildLibrary.EmitMember
Turning off USE_EXPLICIT_INSTANTIATIONS fixes the issue.
To Reproduce
Steps to reproduce the behavior:
- Build with the Visual Studio 15 2017 Win64 generator in the Debug configuration.
- See error in the linking stage
Expected behavior
The compilation should succeed like it does on GCC 7.3.1 with the same source and USE_EXPLICIT_INSTANTIATIONS enabled.
@kmuseth @danrbailey
Does this happen for both static and shared (dll) builds?
This happens when building a static library in the debug configuration. Not sure if it happens with a shared library.
That being said, I am a bit mistaken to consider this an OpenVDB bug -- this is more a bug in MSVC (and a five year old version at that) unless we're doing something that doesn't abide by the standard which isn't the case afaict.
Good to know - we currently don't test static builds with explicit instantiation on Windows (due to CI limitations) which is why I ask. There's nothing obvious as to why this should crash so I suspect it's a MSVC bug but we should investigate.