llvm-project/libcxx
Arthur O'Dwyer dadbe88a13 [libc++] Fix std::to_address(array).
There were basically two bugs here:

When C++20 `to_address` is called on `int arr[10]`, then `const _Ptr&` becomes
a reference to a const array, and then we dispatch to `__to_address<const int(&)[10]>`,
which, oops, gives us a `const int*` result instead of an `int*` result.
Solution: We need to provide the two standard-specified overloads of
`std::to_address` in exactly the same way that we provide two overloads
of `__to_address`.

When `__to_address` is called on a pointer type, `__to_address(const _Ptr&)`
is disabled so we successfully avoid trying to instantiate pointer_traits of
that pointer type. But when it's called on an array type, it's not disabled
for array types, so we go ahead and instantiate pointer_traits<int[10]>,
which goes boom. Solution: We need to disable `__to_address(const _Ptr&)`
for both pointer and array types. Also disable it for function types,
so that they get the nice error message; and put a test on it.

Differential Revision: https://reviews.llvm.org/D109331
2021-09-07 13:56:25 -04:00
..
benchmarks [test] Migrate -gcc-toolchain with space separator to --gcc-toolchain= 2021-08-20 15:24:58 -07:00
cmake [libc++][format] Add a CMake Unicode option. 2021-09-04 11:55:10 +02:00
docs Mention OpenBSD in the documentation 2021-09-07 07:55:17 -04:00
include [libc++] Fix std::to_address(array). 2021-09-07 13:56:25 -04:00
lib [libc++][NFC] Add missing commits to the ABI changelog 2021-07-20 09:19:52 -04:00
src [libc++] Remove some workarounds for unsupported GCC and Clang versions 2021-09-01 10:57:14 -04:00
test [libc++] Fix std::to_address(array). 2021-09-07 13:56:25 -04:00
utils [libc++] Provide 'buildhost=<platform> feature for the tests. 2021-09-07 11:49:53 -04:00
.clang-format
.gitignore
CMakeLists.txt [libc++][format] Add a CMake Unicode option. 2021-09-04 11:55:10 +02:00
CREDITS.TXT [libc++] Update credits.txt per coment on D108263 2021-08-20 08:42:36 -04:00
LICENSE.TXT
TODO.TXT [libcxx][docs] Remove completed issues from TODO.TXT 2021-09-01 08:22:23 -04:00
appveyor-reqs-install.cmd
appveyor.yml