diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-11-25 16:49:45 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-11-25 23:12:14 +0000 |
commit | b8018e5c5ec0e9b6948182f13fba47c67b758d8a (patch) | |
tree | cd93663f7bd2a993e5a5a0feef2b6947e6e8e4a6 /libgcc | |
parent | 1b0acc4b800b589a39d637d7312da5cf969a5765 (diff) | |
download | gcc-b8018e5c5ec0e9b6948182f13fba47c67b758d8a.zip gcc-b8018e5c5ec0e9b6948182f13fba47c67b758d8a.tar.gz gcc-b8018e5c5ec0e9b6948182f13fba47c67b758d8a.tar.bz2 |
libstdc++: Make std::pointer_traits SFINAE-friendly [PR96416]
This implements the resolution I'm proposing for LWG 3545, to avoid hard
errors when using std::to_address for types that make pointer_traits
ill-formed.
Consistent with std::iterator_traits, instantiating std::pointer_traits
for a non-pointer type will be well-formed, but give an empty type with
no member types. This avoids the problematic cases for std::to_address.
Additionally, the pointer_to member is now only declared when the
element type is not cv void (and for C++20, when the function body would
be well-formed). The rebind member was already SFINAE-friendly in our
implementation.
libstdc++-v3/ChangeLog:
PR libstdc++/96416
* include/bits/ptr_traits.h (pointer_traits): Reimplement to be
SFINAE-friendly (LWG 3545).
* testsuite/20_util/pointer_traits/lwg3545.cc: New test.
* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line.
* testsuite/20_util/to_address/lwg3545.cc: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions