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

    <tr>
        <th>Summary</th>
        <td>
            [libc++] Identifier `ptr` is unconditionally used although it is not reserved by the standard library until C++17
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          frederick-vs-ja
      </td>
    </tr>
</table>

<pre>
    This program is supposed be valid until C++17, because the identifier `ptr` is initially introduced into the C++ standard library alongwith `to_chars_result` and `from_chars_result`.

```C++
#define ptr delete
#include <vector>
int main() {}
```

However, it doesn't compile with libc++ in older modes ([Godbolt link](https://godbolt.org/z/aKhKEhKK1)), because the internal helper type `__allocation_result` is used in modes older than C++23 and unconditionally holds a member of name `ptr`. (`count` is OK as `std::count` has been present since C++98.)
https://github.com/llvm/llvm-project/blob/5574a5894fdb7f9a46a4fbe6c8970fd39890dc9b/libcxx/include/__memory/allocate_at_least.h#L31-L35

This seems already discussed in https://reviews.llvm.org/D122877#inline-1179553 but the complete history is no longer accessible...

CC @ldionne @philnik777 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVMmO4zYQ_Rr6UmhDojbzoEN3e5QEPUAuuRtcylZNU6RAUu5xvj6g7F7GQQ4BBFtQkbW89-rJGOnkEHvWPLFmv5FLGn3ojwENBtKvD-f48ENulDeX_q-RIszBn4KcgCLEZZ59RAMK4SwtGVhcIgvPjD8x_lR2jD-DQi2XiJBGBDLoEh0JA7C2mFNgbZETkaNE0toLkEvBm0Wjya9-vXVLBzFJZ2QwYEkFGS4grXenN0pjzpb8QY8yxEPAuNiUM0tncuQY_HQf27Jiz4rH229bXJ9bpdtXXhk8kkOYUwCDFhN-RMhpuxgEVj2fUScfWPXtGiSXYJLkGN8xLoB1T6zb39X5Wvx3_4ZnDBkqSmA8Rsd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