[gcc r16-3823] libstdc++: Constrain __gnu_debug::bitset(const CharT*) constructor [PR121046]

Jonathan Wakely redi@gcc.gnu.org
Fri Sep 12 13:09:00 GMT 2025


https://gcc.gnu.org/g:f534db54a65b42638c08275338423063fe836f31

commit r16-3823-gf534db54a65b42638c08275338423063fe836f31
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Jul 12 13:09:03 2025 +0100

    libstdc++: Constrain __gnu_debug::bitset(const CharT*) constructor [PR121046]
    
    The r16-3435-gbbc0e70b610f19 change (for LWG 4294) needs to be applied
    to the debug mode __gnu_debug::bitset as well as the normal one.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/121046
            * include/debug/bitset (bitset(const CharT*, ...)): Add
            constraints on CharT type.

Diff:
---
 libstdc++-v3/include/debug/bitset | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/debug/bitset b/libstdc++-v3/include/debug/bitset
index e4d3e6619c96..2f4bab846397 100644
--- a/libstdc++-v3/include/debug/bitset
+++ b/libstdc++-v3/include/debug/bitset
@@ -179,7 +179,13 @@ namespace __debug
       bitset(const _Base& __x) : _Base(__x) { }
 
 #if __cplusplus >= 201103L
-      template<typename _CharT>
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 4294. bitset(const CharT*) constructor needs to be constrained
+      template<typename _CharT,
+	       typename = _Require<is_trivially_copyable<_CharT>,
+				   is_standard_layout<_CharT>,
+				   is_trivially_default_constructible<_CharT>,
+				   __not_<is_array<_CharT>>>>
 	_GLIBCXX23_CONSTEXPR
         explicit
         bitset(const _CharT* __str,


More information about the Libstdc++-cvs mailing list