]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix unconditional definition of __cpp_lib_span in <version> [PR 97869}
authorJonathan Wakely <jwakely@redhat.com>
Tue, 17 Nov 2020 15:26:29 +0000 (15:26 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 18 Nov 2020 13:02:15 +0000 (13:02 +0000)
The <span> header is empty unless Concepts are supported, but <version>
defines the __cpp_lib_span feature test macro unconditionally. It should
be guarded by the same conditions as in <span>.

libstdc++-v3/ChangeLog:

PR libstdc++/97869
* include/precompiled/stdc++.h: Include <coroutine>.
* include/std/version (__cpp_lib_span): Check __cpp_lib_concepts
before defining.

(cherry picked from commit ecf65330c11544ebf35e198087b4a42be089c620)

libstdc++-v3/include/precompiled/stdc++.h
libstdc++-v3/include/std/version

index 7518a98c25a0718c235f2a4fe671c10ddaa34a51..5b8f6340448f8a2808c77fcd09c0c083638232a6 100644 (file)
 #include <bit>
 #include <compare>
 #include <concepts>
+#if __cpp_impl_coroutine
+# include <coroutine>
+#endif
 #include <numbers>
 #include <ranges>
 #include <span>
index c3a5bd26e636b1fb12aacc3a7334ba6ac3d245cc..e899a1e6d9901fba642ec58a94e087b1788b9494 100644 (file)
 # define __cpp_lib_ranges 201911L
 #endif
 #define __cpp_lib_shift 201806L
-#define __cpp_lib_span 202002L
+#if __cpp_lib_concepts
+# define __cpp_lib_span 202002L
+#endif
 #define __cpp_lib_ssize 201902L
 #define __cpp_lib_starts_ends_with 201711L
 #define __cpp_lib_to_address 201711L