https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111351

Theodore.Papadopoulo at inria dot fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Theodore.Papadopoulo@inria.
                   |                            |fr

--- Comment #8 from Theodore.Papadopoulo at inria dot fr ---
Would it be at least possible to make the error clearer ?
Currently, it just gives 
In file included from /usr/include/c++/14/string:43,
                 from test.cpp:1:
/usr/include/c++/14/bits/allocator.h: In function ‘int main()’:
/usr/include/c++/14/bits/allocator.h:193:52: error:
‘std::__cxx11::basic_string<char>(((const char*)"abcdefghijklmnopqrst"),
std::allocator<char>())’ is not a constant expression because it refers to a
result of ‘operator new’
  193 |             return static_cast<_Tp*>(::operator new(__n));
      |                                      ~~~~~~~~~~~~~~^~~~~

Without even the stack leading to that place...
Ideally, mention the SSO optimization and its limits ?
It is very disturbing to have two different behaviors depending only on the
length of the string without a (somewhat) clear explanation.

Reply via email to