https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96416
--- Comment #22 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:8d3391d64799d490117ad48432a9ad2cf38b0091 commit r11-9317-g8d3391d64799d490117ad48432a9ad2cf38b0091 Author: Jonathan Wakely <jwak...@redhat.com> Date: Thu Nov 25 23:29:08 2021 +0000 libstdc++: Make std::pointer_traits SFINAE-friendly [PR96416] This is a simplified version of r12-5532 for the release branches. It still removes the problematic static_assert, but rather than making std::pointer_traits completely empty when the element_type can't be deduced, it just disables element_type and pointer_to. Additionally, the pointer_to member is not completely absent when element_type is cv void, it just has an unusable signature. This is sufficient to avoid errors outside the immediate context when trying to use std::to_address. libstdc++-v3/ChangeLog: PR libstdc++/96416 * include/bits/ptr_traits.h (pointer_traits): Remove static_assert checking for valid element_type. (pointer_traits::element_type, pointer_traits::pointer_to): Do not define when element type cannot be deduced. * 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. (cherry picked from commit b8018e5c5ec0e9b6948182f13fba47c67b758d8a)