https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121046
Bug ID: 121046 Summary: Asking is_constructible_v<std::bitset<1>, NonTrivial*> is ill-formed Product: gcc Version: 15.1.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- Found by the libc++ testsuite: #include <bitset> struct NonTrivial { ~NonTrivial() { } }; static_assert( ! std::is_constructible_v<std::bitset<1>, NonTrivial*> ); This fails outside the immediate context, due to the bitset(const CharT*) constructor instantiating std::basic_string<NonTrivial>: In file included from /home/jwakely/gcc/16/include/c++/16.0.0/string:56, from /home/jwakely/gcc/16/include/c++/16.0.0/bitset:54, from bitset.cc:1: /home/jwakely/gcc/16/include/c++/16.0.0/bits/basic_string.h: In instantiation of 'class std::__cxx11::basic_string<NonTrivial, std::char_traits<NonTrivial>, std::allocator<NonTrivial> >': /home/jwakely/gcc/16/include/c++/16.0.0/bitset:1053:2: required by substitution of 'template<class _CharT> std::bitset<1>::bitset(const _CharT*, typename std::__bitset::__string<_CharT>::size_type, _CharT, _CharT) [with _CharT = NonTrivial]' 1053 | bitset(const _CharT* __str, | ^~~~~~ /home/jwakely/gcc/16/include/c++/16.0.0/type_traits:3621:46: required from 'constexpr const bool std::is_constructible_v<std::bitset<1>, NonTrivial*>' 3621 | inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bitset.cc:3:23: required from here 3 | static_assert( ! std::is_constructible_v<std::bitset<1>, NonTrivial*> ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/jwakely/gcc/16/include/c++/16.0.0/bits/basic_string.h:97:21: error: static assertion failed 97 | static_assert(is_trivially_copyable_v<_CharT> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/jwakely/gcc/16/include/c++/16.0.0/bits/basic_string.h:97:21: note: 'std::is_trivially_copyable_v<NonTrivial>' evaluates to false