Open llvmbot opened 5 years ago
However, it is odd that you didn't run into this problem before, since the commit you reference is from 2012.
We indeed ran into this only after FreeBSD upgrade from 11.0 (clang version 3.8.0) to 11.2 (clang version 6.0.0). As I wrote, may be earlier this method was optimized out and thus there were no link error.
I believe you have analyzed the problem correctly - the basic_string is what's tripping you up.
However, it is odd that you didn't run into this problem before, since the commit you reference is from 2012.
Extended Description
In our code we are using basic_stringstream with custom allocator:
typedef std::basic_stringstream<char, std::char_traits, gc_allocator > pa_stringstream;
typedef std::basic_string<char, std::char_traits, gc_allocator > pa_string;
And we have checks for default new operator usage in our code:
void new_disabled(); inline void operator new[] (std::size_t){ return new_disabled(); } inline void *operator new(std::size_t){ return new_disabled(); }
And with FreeBSD clang version 6.0.0 we get the following linker error:
table.C:(.text._ZNSt3116pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8iosbaseES4[_ZNSt3116pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8iosbaseES4]+0x9d): undefined reference to `new_disabled()'
The issue is related to the following commit: https://github.com/llvm-mirror/libcxx/commit/a585de645cccf1b8772c7efc8b77b6c1044ffe2c Where the declaration is without allocator: basic_string<_CharT, _Traits> sp(ns, fl); And if we simply comment out "if (ns > 0)" fragment, the code compiles fine.
Note: there were not link error with previous clang (FreeBSD clang version 3.8.0), where the "locale" code is the same. But may be the whole method was optimized out then.
If required, our full source code is available at https://github.com/artlebedev/parser3/blob/master/src/classes/table.C