diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2025-07-12 13:09:03 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2025-08-28 14:00:48 +0100 |
commit | bbc0e70b610f19320339e4a311591b42bd436e9b (patch) | |
tree | 940e29de33fad6f54b6420c995e62f501eb65128 /libjava/classpath | |
parent | fcb5cd8e9483daafd6f786f3b607028cb1293ce7 (diff) | |
download | gcc-bbc0e70b610f19320339e4a311591b42bd436e9b.zip gcc-bbc0e70b610f19320339e4a311591b42bd436e9b.tar.gz gcc-bbc0e70b610f19320339e4a311591b42bd436e9b.tar.bz2 |
libstdc++: Constrain bitset(const CharT*) constructor [PR121046]
Asking std::is_constructible_v<std::bitset<1>, NonTrivial*> gives an
error, rather than answering the query. The problem is that the
constructor for std::bitset("010101") is not constrained to only accept
pointers to char-like types, and for the second parameter (which has a
default argument) std::basic_string_view<CharT> gets instantiated. If
the type is not char-like then that has undefined behaviour, and might
trigger a static_assert to fail in the body of std::basic_string_view.
We can fix it by constraining that constructor using the requirements
for char-like types from [strings.general] p1. I've submitted LWG 4294
and proposed making this change in the standard.
libstdc++-v3/ChangeLog:
PR libstdc++/121046
* include/std/bitset (bitset(const CharT*, ...)): Add
constraints on CharT type.
* testsuite/23_containers/bitset/lwg4294.cc: New test.
Diffstat (limited to 'libjava/classpath')
0 files changed, 0 insertions, 0 deletions