]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix <ostream> and <istream> for -std=gnu++14 -fconcepts [PR116070]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 24 Jul 2024 10:32:22 +0000 (11:32 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 24 Jul 2024 16:18:05 +0000 (17:18 +0100)
This questionable combination of flags causes a number of errors. The
ones in the rvalue stream overloads need to be fixed in the gcc-14
branch so I'm committing it separately to simplify backporting.

libstdc++-v3/ChangeLog:

PR libstdc++/116070
* include/std/istream: Check feature test macro before using
is_class_v and is_same_v.
* include/std/ostream: Likewise.

libstdc++-v3/include/std/istream
libstdc++-v3/include/std/ostream

index 11d51d3e666c8316a92d8899b2465d2ae848300e..a2b207dae78cfdd318cc563f314971e11da3b45c 100644 (file)
@@ -1069,7 +1069,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // 2328. Rvalue stream extraction should use perfect forwarding
   // 1203. More useful rvalue stream insertion
 
-#if __cpp_concepts >= 201907L
+#if __cpp_concepts >= 201907L && __glibcxx_type_trait_variable_templates
   template<typename _Is, typename _Tp>
     requires __derived_from_ios_base<_Is>
       && requires (_Is& __is, _Tp&& __t) { __is >> std::forward<_Tp>(__t); }
index 8a21758d0a337663f37adf448189f6670668a7fe..12be6c4fd17859ae27ff068efecbb873cfc4a57b 100644 (file)
@@ -768,7 +768,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // 1203. More useful rvalue stream insertion
 
-#if __cpp_concepts >= 201907L
+#if __cpp_concepts >= 201907L && __glibcxx_type_trait_variable_templates
   // Use concepts if possible because they're cheaper to evaluate.
   template<typename _Tp>
     concept __derived_from_ios_base = is_class_v<_Tp>