Title
Some more feature-test macros for fully freestanding features are not marked freestanding
Status
new
Section
[version.syn][memory.syn]
Submitter
Yihe Li

Created on 2025-06-17.00:00:00 last changed 1 week ago

Messages

Date: 2025-07-05.16:21:30

Proposed resolution:

This wording is relative to N5008.

  1. Modify [version.syn], header <version> synopsis, as indicated:

    […]
    #define __cpp_lib_aligned_accessor             202411L // freestanding, also in <mdspan>
    […]                                     
    #define __cpp_lib_array_constexpr              201811L // freestanding, also in <iterator>, <array>
    […]                                     
    #define __cpp_lib_clamp                        201603L // freestanding, also in <algorithm>
    […]                                     
    #define __cpp_lib_constexpr_numeric            201911L // freestanding, also in <numeric>
    […]                                     
    #define __cpp_lib_function_ref                 202306L // freestanding, also in <functional>
    #define __cpp_lib_gcd_lcm                      201606L // freestanding, also in <numeric>
    […]
    #define __cpp_lib_integer_comparison_functions 202002L // freestanding, also in <utility>
    […]
    #define __cpp_lib_is_sufficiently_aligned      202411L // freestanding, also in <memory>
    […]
    #define __cpp_lib_ranges_contains              202207L // freestanding, also in <algorithm>
    #define __cpp_lib_ranges_enumerate             202302L // freestanding, also in <ranges>
    #define __cpp_lib_ranges_find_last             202207L // freestanding, also in <algorithm>
    #define __cpp_lib_ranges_fold                  202207L // freestanding, also in <algorithm>
    […]
    #define __cpp_lib_ranges_iota                  202202L // freestanding, also in <numeric>
    […]
    #define __cpp_lib_ranges_starts_ends_with      202106L // freestanding, also in <algorithm>
    […]
    #define __cpp_lib_robust_nonmodifying_seq_ops  201304L // freestanding, also in <algorithm>
    #define __cpp_lib_sample                       201603L // freestanding, also in <algorithm>
    #define __cpp_lib_saturation_arithmetic        202311L // freestanding, also in <numeric>
    […]
    
  2. Modify [memory.syn], header <memory> synopsis, as indicated:

    […]
    template<size_t Alignment, class T>
      bool is_sufficiently_aligned(T* ptr);      // freestanding
    […]
    
Date: 2025-07-05.16:21:30

P1642R11 (accepted in C++23) plus LWG 4189 (accepted in Hagenberg) added nearly the entire <ranges> header to freestanding. However, the only feature-test macro being added to freestanding is `__cpp_lib_ranges_cache_latest`, which seems weird, since `views::enumerate` is also added to freestanding following the blanket comment strategy, but its feature-test macro remains not in freestanding. In retrospective, since all range algorithms are in freestanding via P2976, all `__cpp_lib_ranges_*` FTMs (except `__cpp_lib_ranges_generate_random` since `ranges::generate_random` is not in freestanding) should probably be marked as freestanding.

Furthermore, LWG 4126 left out some other FTMs for fully freestanding features. They are also added in the following wording.

A note about `is_sufficiently_aligned`: P2897R7 does indicate in 5.7.6.1 that the function should be freestanding, but somehow the wording didn't say so. The following wording includes the function and its FTM anyway since hopefully this is just an omission when wording the paper.

History
Date User Action Args
2025-07-05 16:01:56adminsetmessages: + msg14877
2025-06-17 00:00:00admincreate