diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-07-24 11:32:22 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2024-07-28 19:05:52 +0200 |
commit | 00fc1169f7cea8149c2a5442d07b64615cb8b336 (patch) | |
tree | 3b766363e11a8e514c94040426d24af98d33e9a8 | |
parent | a45833868858e10293d68c72717ebec533e189a8 (diff) | |
download | gcc-00fc1169f7cea8149c2a5442d07b64615cb8b336.zip gcc-00fc1169f7cea8149c2a5442d07b64615cb8b336.tar.gz gcc-00fc1169f7cea8149c2a5442d07b64615cb8b336.tar.bz2 |
libstdc++: Fix <ostream> and <istream> for -std=gnu++14 -fconcepts [PR116070]
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.
-rw-r--r-- | libstdc++-v3/include/std/istream | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/std/ostream | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream index 11d51d3..a2b207d 100644 --- a/libstdc++-v3/include/std/istream +++ b/libstdc++-v3/include/std/istream @@ -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); } diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream index 8a21758..12be6c4 100644 --- a/libstdc++-v3/include/std/ostream +++ b/libstdc++-v3/include/std/ostream @@ -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> |