<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/143708>143708</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Confusing Error Message with placement new
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
spinicist
</td>
</tr>
</table>
<pre>
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`)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxkU12PrDYM_TXmxdoRJMPXAw_sdKfdh75dqY9VCAbShgTFYWa3v74KO-29uxchgRL7-PgcWzGb2RF1UD5D-Uum9rj40PFmnNGGYzb48b37thhG7UcC2eMS48YgexBXENfZj4O38eTDDOL6D4hrKcs3_cfLNEHeQ97_am7EGBfCyVvr78bNSCH4gHcTF4xhd3_jxSo3J8wjBar88eY9yAv7PWgC-QKyb0D2bWJxQKQf53FVUS8JF0TtNwoq-oCO7iBqnHano_EOp3Tm3ZOy1msVU_hmlaaVXEzBSG9bIGbjHchnNE7bfSQEeUlI8gXyHhGxQagv-N-T8kA0ICoG0SLHMTUhe96UA9HwnyBakM9fe8r73_ydbhRAXPAVF3WjQyHe55k40ogpUMifSVT5Cb8thFvwg6UVDaPz8Uj-3I2JTHZK-MOe7tVHUDIRYzDJEo_rHlUkVKmc9o4jVDmutA4U8KaCUYOlE75OR-qPMYYx0OpvNKJ3aI0jLL_ja79uxlIamRBIR_t-wt49XF-JWc2EmzfucCH6uwoj_1TjCw-8-92OOBCqbQukjYo0nh4DI5pXXExq0fD_2hzzpTC-b4TKGsVoHCq0ZggqvH9o8lD4ozq9xfBJCxBtNnZybGWrMuqK-txWZSErmS2dbuS5ovxcyUm3jWqrdpBalFOrp6FuqnNmOpGLMq-KojgXVS5PQsm6GEpdUZ0XTdnCOadVGXuy9ramBcoM805dcZZ13mRWDWT5WEwhDkvTLQiR9jR0Kelp2GeGc24NR_4OE0201F28m3ZOCr8cwv_-EP6Q5dOwZHuw3Ze1NnHZh5P2K4hrAn58nrbg_yIdQVwPOgzi-uB768S_AQAA__8FQGUK">