-
Notifications
You must be signed in to change notification settings - Fork 13.5k
clang-cl does not work with /MDd
(dynamic debug CRT) due to std::locale
link errors
#18630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't understand the first error, but the last looks like there's some kind of debug/release mismatch (
This is probably a mangler bug, or we're failing to instantiate an inline function that VC++ normally instantiates. |
The compiler command line shows that it is compiling the debug version. The linker line, which invokes the Microsoft linker is:
where the response file is simply:
The compile succeeds but the link gives an error. If you think the |
In Visual Studio 2012, when building with template<class _Ty> void _DebugHeapDelete(_Ty *_Ptr)
{
if (_Ptr != 0)
{
_Ptr->~_Ty();
free(_Ptr);
}
} with no other overrides or overloads that I can see. The clang-cl I'm using here just reports So it's probably not resolving when linking because it's supposed to be an instantiated template that MSVC's CL doesn't fail on, but clang-cl does. This is using the LLVM-3.5.r198737-win32 snapshot with -cxx-abi itanium, I'm guessing one of the compiler switches in the original report is causing clang-cl to turn the "cannot instantiate template" into an implicit "extern template class". |
Sorry, left out that the same header also provides the following macro: #define _DELETE_CRT_VEC(ptr) _STD _DebugHeapDelete((void *)ptr) So it's definitely intentional that |
I can reproduce the problem by streaming a number, which invokes the locale machinery: $ cat t.cpp #include <iostream>
int main() {
int x = 123;
std::cout << x << '\n';
} $ cl -nologo -D_HAS_EXCEPTIONS=0 -GR- -MTd -D_DEBUG -c t.cpp && dumpbin /symbols t.obj | grep 'DebugHeapDelete<void>'
t.cpp
585 00000000 SECTAC notype () External | ??$_DebugHeapDelete@X@std@@YAXPAX@Z (void __cdecl std::_DebugHeapDelete<void>(void *))
$ clang-cl -D_HAS_EXCEPTIONS=0 -GR- -MTd -D_DEBUG -c t.cpp && dumpbin /symbols t.obj | grep 'DebugHeapDelete<void>'
3F1 00000000 UNDEF notype External | ??$_DebugHeapDelete@X@std@@YAXPAX@Z (void __cdecl std::_DebugHeapDelete<void>(void *)) MSVC provides a definition for If I use |
I fixed the |
/MDd
(dynamic debug CRT) due to std::locale
link errors
Extended Description
Atempting to link an executable while testing Boost libraries with clang-cl I am seeing this error in a number of situations:
The command line for clang-cl has these options:
-TP /Od /Ob0 /W3 /GR /MDd /Zc:forScope /Zc:wchar_t -fmsc-version=1700 /wd4675 /EHs /D_HAS_EXCEPTIONS=0 /GR- -c
The text was updated successfully, but these errors were encountered: