aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorArthur O'Dwyer <arthur.j.odwyer@gmail.com>2021-09-06 14:11:45 -0400
committerArthur O'Dwyer <arthur.j.odwyer@gmail.com>2021-09-07 13:56:25 -0400
commitdadbe88a1387e7b1fe4417fa4b64234ffc83c878 (patch)
tree08224d9808a4c1f4748194726ad9eb344b8a2df7 /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent84169fb67e94036dac70467c3d421746e8057478 (diff)
downloadllvm-dadbe88a1387e7b1fe4417fa4b64234ffc83c878.zip
llvm-dadbe88a1387e7b1fe4417fa4b64234ffc83c878.tar.gz
llvm-dadbe88a1387e7b1fe4417fa4b64234ffc83c878.tar.bz2
[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
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions