https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77748
--- Comment #7 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- This avoids also the _Alloc_hider constructor. But it still reproduces with gcc-6 and gcc-7. I have found no way to add __attribute((noinline, noclone)) to the template specialization, that works. So I did the dirty trick... It would not have been able to link with gcc-6 because the signature appears to have changed. So that would have been necessary to do anyway. Can you try this please? --- pr77550.C.orig 2016-09-27 10:05:17.812179103 +0200 +++ pr77550.C 2016-09-27 13:08:25.465060583 +0200 @@ -231,13 +231,15 @@ template <typename, typename, typename> } _M_dataplus; size_type _M_string_length; enum { _S_local_capacity = 15 } _M_local_buf[_S_local_capacity]; - pointer _M_local_data(); - void _M_set_length(size_type); - basic_string() : _M_dataplus(_M_local_data()) { _M_set_length(0); } + basic_string() : _M_dataplus(0) {} basic_string(const basic_string &) : _M_dataplus(0) {} size_type size() { return _M_string_length; } char *data() const {} }; +//template<> basic_string<char, std::char_traits<char>, std::allocator<char>>:: +//_Alloc_hider::_Alloc_hider(char*, std::allocator<char>&&) {} +extern "C" void +_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderC1EPcOS3_ (...) {} } template <typename _CharT> int operator==(basic_string<_CharT> &p1, const basic_string<_CharT> &p2) {