I got some very simple code, dumbed down from a larger one:
[~]> cat wc.cpp
#include
int wc() {
return 0;
}
int main()
{
std::cout << wc() << std::endl;
}
[~]> /opt/clang/bin/clang++ -stdlib=libc++ -fsanitize=undefined wc.cpp
[~]> ./a.out
/opt/clang/bin/…/include/c++/v1/ostream:1034:14: runtime error: member call on address 0x000000ef9858 which does not point to an object of type ‘std::__1::basic_ios’
0x000000ef9850: note: object is base class subobject at offset 8 within object of type ‘std::__1::basic_ostream<char, std::__1::char_traits >’
00 00 00 00 40 a3 b9 c6 b1 7f 00 00 68 a3 b9 c6 b1 7f 00 00 02 10 00 00 00 00 00 00 06 00 00 00
^ ~~~~~~~~~~~~~~~~~~~~~~~
vptr for ‘’ base class of ‘std::__1::basic_ostream<char, std::__1::char_traits >’
/opt/clang/bin/…/include/c++/v1/ios:734:41: runtime error: member call on address 0x000000ef9858 which does not point to an object of type ‘std::__1::ios_base’
0x000000ef9850: note: object is base class subobject at offset 8 within object of type ‘std::__1::basic_ostream<char, std::__1::char_traits >’
00 00 00 00 40 a3 b9 c6 b1 7f 00 00 68 a3 b9 c6 b1 7f 00 00 02 10 00 00 00 00 00 00 06 00 00 00
^ ~~~~~~~~~~~~~~~~~~~~~~~
vptr for ‘’ base class of ‘std::__1::basic_ostream<char, std::__1::char_traits >’
0
Works fine if I link to libstdc++. clang is r223341.