<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/154866>154866</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libcxx] `abi_tag` on global `operator new` declarations appears to be non-conforming
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zygoloid
      </td>
    </tr>
</table>

<pre>
    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).
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVEtv6zYT_TXjzSCGTD290EJ-6H4GviZB4qLdCZQ0klnQpEpSvnF-fUFFTnzb212FgR8UZnjOmTPDrRW9Isoh3kC8W_DRnbTJ36-9llq0i1q31_xI1jXcEoQFBFMkwUc0wDY-guKiRQusQD2Q4U4bVPQdWNZSI911IGCZFe-kO2BZAGw9xRbnLGBrVJreGhochL4csFCoRo4tIYRbXyvc31_8geOANUlBF0J3EhaFxQuXol3iZnQI8WYruerxu3AnlKKewaKhP6hxFuIdsOzk3GA9MVYCK3vd1lq6pTY9sPIdWJl20Z_R8bfk3SP-J3-trJY0AS5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