diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2025-04-15 14:01:55 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2025-04-15 17:34:34 +0100 |
commit | df59bf20d85384f56395f573f294ddd45327347a (patch) | |
tree | da1c336812b837c7e693d7253602bf58d1d420f7 /libstdc++-v3/include/std/numeric | |
parent | edb4867412895100b3addc525bc0dba0ea90c7f9 (diff) | |
download | gcc-df59bf20d85384f56395f573f294ddd45327347a.zip gcc-df59bf20d85384f56395f573f294ddd45327347a.tar.gz gcc-df59bf20d85384f56395f573f294ddd45327347a.tar.bz2 |
libstdc++: Do not declare namespace ranges in <numeric> unconditionally
Move namespace ranges inside the feature test macro guard, because
'ranges' is not a reserved name before C++20.
libstdc++-v3/ChangeLog:
* include/std/numeric (ranges): Only declare namespace for C++23
and later.
(ranges::iota_result): Fix indentation.
* testsuite/17_intro/names.cc: Check ranges is not used as an
identifier before C++20.
Diffstat (limited to 'libstdc++-v3/include/std/numeric')
-rw-r--r-- | libstdc++-v3/include/std/numeric | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric index 4d36fcd..490963e 100644 --- a/libstdc++-v3/include/std/numeric +++ b/libstdc++-v3/include/std/numeric @@ -732,12 +732,11 @@ namespace __detail /// @} group numeric_ops #endif // C++17 +#if __glibcxx_ranges_iota >= 202202L // C++ >= 23 namespace ranges { -#if __glibcxx_ranges_iota >= 202202L // C++ >= 23 - template<typename _Out, typename _Tp> - using iota_result = out_value_result<_Out, _Tp>; + using iota_result = out_value_result<_Out, _Tp>; struct __iota_fn { @@ -762,9 +761,8 @@ namespace ranges }; inline constexpr __iota_fn iota{}; - -#endif // __glibcxx_ranges_iota } // namespace ranges +#endif // __glibcxx_ranges_iota _GLIBCXX_END_NAMESPACE_VERSION } // namespace std |