[committed] libstdc++: Constrain __gnu_debug::bitset(const CharT*) constructor [PR121046]

Message ID 20250912130923.1973635-1-jwakely@redhat.com
State Committed
Commit f534db54a65b42638c08275338423063fe836f31
Headers
Series [committed] libstdc++: Constrain __gnu_debug::bitset(const CharT*) constructor [PR121046] |

Commit Message

Jonathan Wakely Sept. 12, 2025, 1:09 p.m. UTC
  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.
---

Tested x86_64-linux. Pushed to trunk.

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

Patch

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,