Confusing Error Message with placement new (original) (raw)

This code: https://godbolt.org/z/535xcWEff

Gives the following error with trunk Clang:

<source>:8:9: error: no matching 'operator new' function for non-allocating placement new expression; include <new>
    8 |         new (&s) std::span(s_);

However, I have the suggested #include <new>. The problem is not the placement new itself, but that the code tries to mutate a const member variable. If the const is removed on line 5 the code compiles correctly. An error message pointing towards the const member variable would be appreciated.

(I hit this problem with a type alias in a library that includes the extra const)