public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed 1/2] libstdc++: Adjust feature test in <istream> and <ostream>
@ 2023-11-16  8:02 Jonathan Wakely
  2023-11-16  8:02 ` [committed 2/2] libstdc++: Use 202100L as feature test check for C++23 Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2023-11-16  8:02 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested x86_64-linux. Pushed to trunk.

-- >8 --

We don't need any library concepts to define the constraints for rvalue
stream overloads, only compiler support. So change the test from using
__cpp_lib_concepts to __cpp_concepts >= 201907L.

libstdc++-v3/ChangeLog:

	* include/std/istream (__rvalue_stream_extraction_t): Test
	__cpp_concepts instead of __cpp_lib_concepts.
	* include/std/ostream (__derived_from_ios_base): Likewise.
	(__rvalue_stream_insertion_t): Likewise.
---
 libstdc++-v3/include/std/istream | 2 +-
 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 25d36973f4b..c2b30b75957 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_lib_concepts
+#if __cpp_concepts >= 201907L
   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 5f973fa11ed..1de1c1bd359 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -763,7 +763,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // 1203. More useful rvalue stream insertion
 
-#if __cpp_lib_concepts
+#if __cpp_concepts >= 201907L
   // Use concepts if possible because they're cheaper to evaluate.
   template<typename _Tp>
     concept __derived_from_ios_base = is_class_v<_Tp>
-- 
2.41.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [committed 2/2] libstdc++: Use 202100L as feature test check for C++23
  2023-11-16  8:02 [committed 1/2] libstdc++: Adjust feature test in <istream> and <ostream> Jonathan Wakely
@ 2023-11-16  8:02 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2023-11-16  8:02 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested x86_64-linux. Pushed to trunk.

-- >8 --

I noticed that our C++23 features were not being defined when using
Clang 16 with -std=c++2b, because it only defines __cplusplus=202101L
but <bits/version.h> uses 202302L since my r14-3252-g0c316669b092fb
change.

This changes <bits/version.h> to use 202100 instead of the final 202302
value so that we support Clang 16's -std=c++2b mode.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (stds): Use >= 202100 for C++23
	condition.
	* include/bits/version.h: Regenerate.
	* include/std/thread: Use > C++20 instead of >= C++23 for
	__cplusplus condition.
---
 libstdc++-v3/include/bits/version.def |  2 +-
 libstdc++-v3/include/bits/version.h   | 76 +++++++++++++--------------
 libstdc++-v3/include/std/thread       |  2 +-
 3 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
index 8f008f9048f..2aab9426ecc 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -1640,7 +1640,7 @@ stds[11] = ">= 201103L";
 stds[14] = ">= 201402L";
 stds[17] = ">= 201703L";
 stds[20] = ">= 202002L";
-stds[23] = ">= 202302L";
+stds[23] = ">= 202100L"; // Should be 202302L but Clang 16 uses 202101L
 stds[26] = ">  202302L"; // TODO: update when finalized
 
 // Local Variables:
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index c182a4d56c1..39042d7cdf5 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -42,7 +42,7 @@
 # include <stop_token>	// std::stop_source, std::stop_token, std::nostopstate
 #endif
 
-#if __cplusplus >= 202302L
+#if __cplusplus > 202002L
 # include <format>
 #endif
 
-- 
2.41.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-16  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16  8:02 [committed 1/2] libstdc++: Adjust feature test in <istream> and <ostream> Jonathan Wakely
2023-11-16  8:02 ` [committed 2/2] libstdc++: Use 202100L as feature test check for C++23 Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).