Issue |
154866
|
Summary |
[libcxx] `abi_tag` on global `operator new` declarations appears to be non-conforming
|
Labels |
libc++
|
Assignees |
|
Reporter |
zygoloid
|
Testcase:
```c++
void* operator new(decltype(sizeof(0)), void*) noexcept;
#include <new>
```
I believe this is valid. But [Clang with libc++ rejects](https://godbolt.org/z/7f4q4TW6z):
```console
/usr/include/c++/v1/new:245:26: error: cannot add 'abi_tag' attribute in a redeclaration
245 | _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI void* operator new(std::size_t, void* __p) _NOEXCEPT { return __p; }
| ^
545 | __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
| ^
<carbon-internal>:4:7: note: previous declaration is here
4 | void* operator new(decltype(sizeof(0)), void*) noexcept;
| ^
```
Note that the normal rule that prevents user code from declaring entities that the standard library also declares [only applies within namespace `std`](https://eel.is/c++draft/library#namespace.std-1).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs