https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77748
--- Comment #20 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- Bah. Your target defaults to -fshort-enums: that makes the basic_string structure much too short it uses an array of enum to keep it at the same size as the original. Now please try this: Index: pr77550.C =================================================================== --- pr77550.C (revision 240540) +++ pr77550.C (working copy) @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-options "-std=c++14 -O3" } +// { dg-options "-std=c++14 -O3 -fno-short-enums" } namespace std { typedef int size_t; @@ -229,15 +229,17 @@ struct _Alloc_hider { _Alloc_hider(pointer, allocator<char> && = allocator<char>()); } _M_dataplus; - size_type _M_string_length; + size_type _M_string_length = 0; 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) {