Issue 143708
Summary Confusing Error Message with placement new
Labels new issue
Assignees
Reporter spinicist
    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`)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to