Skip to content

Commit d3a7da7

Browse files
frederick-vs-jaStephanTLavavejstrega-nilCaseyCarter
authored
Cite N4950 in headers and source files (#3686)
Towards #182. - This PR drops all section numbers except for D.x in `<yvals_core.h>`. I decided to cite WG21-N4868 for C++20 deprecation. - Some citations in `<format>` are intentionally not updated because WG21-P2675R1 and LWG-3631 are not implemented yet. - Citations in test files are not updated, but I think I'll do it soon. - Drive-by change: a comment for `move_only_function`'s move assignment operator explaining why it's `noexcept(false)` (see #3565 (comment) and #2278 (comment)). --------- Co-authored-by: Stephan T. Lavavej <[email protected]> Co-authored-by: Nicole Mazzuca <[email protected]> Co-authored-by: Casey Carter <[email protected]>
1 parent 04db120 commit d3a7da7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+448
-443
lines changed

stl/inc/__msvc_chrono.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ namespace chrono {
196196
using period = typename _Duration::period;
197197

198198
static_assert(_Is_duration_v<_Duration>,
199-
"N4885 [time.point.general]/1 mandates Duration to be a specialization of chrono::duration.");
199+
"N4950 [time.point.general]/1 mandates Duration to be a specialization of chrono::duration.");
200200

201201
constexpr time_point() = default;
202202

stl/inc/algorithm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5454,7 +5454,7 @@ _EXPORT_STD template <class _FwdIt>
54545454
constexpr _FwdIt shift_left(_FwdIt _First, const _FwdIt _Last, _Iter_diff_t<_FwdIt> _Pos_to_shift) {
54555455
// shift [_First, _Last) left by _Pos_to_shift
54565456
// positions; returns the end of the resulting range
5457-
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4910 [alg.shift]/1)");
5457+
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4950 [alg.shift]/1)");
54585458

54595459
_Adl_verify_range(_First, _Last);
54605460

@@ -5495,7 +5495,7 @@ _EXPORT_STD template <class _FwdIt>
54955495
constexpr _FwdIt shift_right(_FwdIt _First, const _FwdIt _Last, _Iter_diff_t<_FwdIt> _Pos_to_shift) {
54965496
// shift [_First, _Last) right by _Pos_to_shift
54975497
// positions; returns the beginning of the resulting range
5498-
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4910 [alg.shift]/5)");
5498+
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4950 [alg.shift]/5)");
54995499

55005500
_Adl_verify_range(_First, _Last);
55015501

@@ -5581,7 +5581,7 @@ namespace ranges {
55815581

55825582
template <permutable _It, sentinel_for<_It> _Se>
55835583
constexpr subrange<_It> operator()(_It _First, const _Se _Last, iter_difference_t<_It> _Pos_to_shift) const {
5584-
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4910 [alg.shift]/1)");
5584+
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4950 [alg.shift]/1)");
55855585

55865586
_Adl_verify_range(_First, _Last);
55875587
auto _Result = _First;
@@ -5599,7 +5599,7 @@ namespace ranges {
55995599
template <forward_range _Rng>
56005600
requires permutable<iterator_t<_Rng>>
56015601
constexpr borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, range_difference_t<_Rng> _Pos_to_shift) const {
5602-
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4910 [alg.shift]/1)");
5602+
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4950 [alg.shift]/1)");
56035603

56045604
if (_Pos_to_shift == 0) {
56055605
auto _Last = _Rewrap_iterator(_Range, _Get_final_iterator_unwrapped(_Range));
@@ -5703,7 +5703,7 @@ namespace ranges {
57035703
_It _First, _Se _Last, iter_difference_t<_It> _Pos_to_shift, const _SizeTy _Size) {
57045704
_STL_INTERNAL_STATIC_ASSERT(permutable<_It>);
57055705
_STL_INTERNAL_STATIC_ASSERT(sentinel_for<_Se, _It>);
5706-
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4910 [alg.shift]/5)");
5706+
_STL_ASSERT(_Pos_to_shift >= 0, "shift count must be non-negative (N4950 [alg.shift]/5)");
57075707

57085708
if (_Pos_to_shift == 0) {
57095709
return {_First, _RANGES next(_First, _Last)};
@@ -10061,7 +10061,7 @@ namespace ranges {
1006110061
const auto _First = _Range.begin();
1006210062
const auto _Last = _Range.end();
1006310063
_STL_ASSERT(_First != _Last,
10064-
"An initializer_list passed to std::ranges::minmax must not be empty. (N4928 [alg.min.max]/21)");
10064+
"An initializer_list passed to std::ranges::minmax must not be empty. (N4950 [alg.min.max]/21)");
1006510065
return _Minmax_fwd_unchecked(_First, _Last, _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj));
1006610066
}
1006710067

@@ -10073,13 +10073,13 @@ namespace ranges {
1007310073
auto _UFirst = _RANGES _Ubegin(_Range);
1007410074
auto _ULast = _RANGES _Uend(_Range);
1007510075
_STL_ASSERT(
10076-
_UFirst != _ULast, "A range passed to std::ranges::minmax must not be empty. (N4928 [alg.min.max]/21)");
10076+
_UFirst != _ULast, "A range passed to std::ranges::minmax must not be empty. (N4950 [alg.min.max]/21)");
1007710077
if constexpr (forward_range<_Rng> && _Prefer_iterator_copies<iterator_t<_Rng>>) {
1007810078
return _Minmax_fwd_unchecked(
1007910079
_STD move(_UFirst), _STD move(_ULast), _STD _Pass_fn(_Pred), _STD _Pass_fn(_Proj));
1008010080
} else {
1008110081
using _Vty = range_value_t<_Rng>;
10082-
// This initialization is correct, similar to the N4928 [dcl.init.aggr]/6 example
10082+
// This initialization is correct, similar to the N4950 [dcl.init.aggr]/6 example
1008310083
minmax_result<_Vty> _Found = {static_cast<_Vty>(*_UFirst), _Found.min};
1008410084
if (_UFirst == _ULast) {
1008510085
return _Found;
@@ -10147,7 +10147,7 @@ namespace ranges {
1014710147

1014810148
auto _Found_min = _First;
1014910149
if (++_First == _Last) {
10150-
// This initialization is correct, similar to the N4928 [dcl.init.aggr]/6 example
10150+
// This initialization is correct, similar to the N4950 [dcl.init.aggr]/6 example
1015110151
minmax_result<_Vty> _Result = {static_cast<_Vty>(*_Found_min), _Result.min};
1015210152
return _Result;
1015310153
}
@@ -10568,7 +10568,7 @@ namespace ranges {
1056810568
const _Ty& _Val, const _Ty& _Lo, const _Ty& _Hi, _Pr _Pred = {}, _Pj _Proj = {}) const {
1056910569
_STL_ASSERT(!_STD invoke(_Pred, _STD invoke(_Proj, _Hi), _STD invoke(_Proj, _Lo)),
1057010570
"The lower bound cannot be greater than the upper bound in a call to std::ranges::clamp "
10571-
"(N4861 [alg.clamp]/2).");
10571+
"(N4950 [alg.clamp]/2).");
1057210572

1057310573
auto&& _Temp = _STD invoke(_Proj, _Val);
1057410574
if (_STD invoke(_Pred, _STD forward<decltype(_Temp)>(_Temp), _STD invoke(_Proj, _Lo))) {

stl/inc/array

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,8 @@ public:
580580
#if _HAS_CXX17
581581
template <class _First, class... _Rest>
582582
struct _Enforce_same {
583-
static_assert(conjunction_v<is_same<_First, _Rest>...>,
584-
"N4687 26.3.7.2 [array.cons]/2: "
585-
"Requires: (is_same_v<T, U> && ...) is true. Otherwise the program is ill-formed.");
583+
static_assert(
584+
conjunction_v<is_same<_First, _Rest>...>, "N4950 [array.cons]/2: Mandates: (is_same_v<T, U> && ...) is true.");
586585
using type = _First;
587586
};
588587

@@ -830,18 +829,18 @@ _NODISCARD constexpr array<remove_cv_t<_Ty>, _Size> _To_array_rvalue_impl(
830829

831830
_EXPORT_STD template <class _Ty, size_t _Size>
832831
_NODISCARD constexpr array<remove_cv_t<_Ty>, _Size> to_array(_Ty (&_Array)[_Size]) {
833-
static_assert(!is_array_v<_Ty>, "N4830 [array.creation]/1: "
832+
static_assert(!is_array_v<_Ty>, "N4950 [array.creation]/1: "
834833
"to_array does not accept multidimensional arrays.");
835-
static_assert(is_constructible_v<_Ty, _Ty&>, "N4830 [array.creation]/1: "
834+
static_assert(is_constructible_v<_Ty, _Ty&>, "N4950 [array.creation]/1: "
836835
"to_array requires copy constructible elements.");
837836
return _To_array_lvalue_impl(_Array, make_index_sequence<_Size>{});
838837
}
839838

840839
_EXPORT_STD template <class _Ty, size_t _Size>
841840
_NODISCARD constexpr array<remove_cv_t<_Ty>, _Size> to_array(_Ty (&&_Array)[_Size]) {
842-
static_assert(!is_array_v<_Ty>, "N4830 [array.creation]/4: "
841+
static_assert(!is_array_v<_Ty>, "N4950 [array.creation]/4: "
843842
"to_array does not accept multidimensional arrays.");
844-
static_assert(is_move_constructible_v<_Ty>, "N4830 [array.creation]/4: "
843+
static_assert(is_move_constructible_v<_Ty>, "N4950 [array.creation]/4: "
845844
"to_array requires move constructible elements.");
846845
return _To_array_rvalue_impl(_STD move(_Array), make_index_sequence<_Size>{});
847846
}

stl/inc/barrier

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ public:
7474
is_function_v<remove_pointer_t<_Completion_function>> ||
7575
#endif // __cpp_noexcept_function_type
7676
is_nothrow_invocable_v<_Completion_function&>,
77-
"N4861 [thread.barrier.class]/5: is_nothrow_invocable_v<CompletionFunction&> shall be true");
77+
"N4950 [thread.barrier.class]/5: is_nothrow_invocable_v<CompletionFunction&> shall be true");
7878

7979
using arrival_token = _Arrival_token<_Completion_function>;
8080

8181
constexpr explicit barrier(
8282
const ptrdiff_t _Expected, _Completion_function _Fn = _Completion_function()) noexcept /* strengthened */
8383
: _Val(_One_then_variadic_args_t{}, _STD move(_Fn), _Expected << _Barrier_value_shift) {
8484
_STL_VERIFY(_Val._Myval2._Current.load(memory_order_relaxed) >= 0,
85-
"Precondition: expected >= 0 and expected <= max() (N4861 [thread.barrier.class]/9)");
85+
"Precondition: expected >= 0 and expected <= max() (N4950 [thread.barrier.class]/9)");
8686
}
8787

8888
barrier(const barrier&) = delete;
@@ -95,11 +95,11 @@ public:
9595
_NODISCARD_BARRIER_TOKEN arrival_token arrive(ptrdiff_t _Update = 1) noexcept /* strengthened */ {
9696
// Shifting before precondition check, so that exceeding max() will trigger precondition check too
9797
_Update <<= _Barrier_value_shift;
98-
_STL_VERIFY(_Update > 0, "Precondition: update > 0 (N4861 [thread.barrier.class]/12)");
98+
_STL_VERIFY(_Update > 0, "Precondition: update > 0 (N4950 [thread.barrier.class]/12)");
9999
// TRANSITION, GH-1133: should be memory_order_release
100100
ptrdiff_t _Current = _Val._Myval2._Current.fetch_sub(_Update) - _Update;
101101
_STL_VERIFY(_Current >= 0, "Precondition: update is less than or equal to the expected count "
102-
"for the current barrier phase (N4861 [thread.barrier.class]/12)");
102+
"for the current barrier phase (N4950 [thread.barrier.class]/12)");
103103
if ((_Current & _Barrier_value_mask) == 0) {
104104
// TRANSITION, GH-1133: should have this fence:
105105
// atomic_thread_fence(memory_order_acquire);
@@ -114,14 +114,14 @@ public:
114114
void wait(arrival_token&& _Arrival) const noexcept /* strengthened */ {
115115
_STL_VERIFY((_Arrival._Value & _Barrier_value_mask) == reinterpret_cast<intptr_t>(this),
116116
"Preconditions: arrival is associated with the phase synchronization point for the current phase "
117-
"or the immediately preceding phase of the same barrier object (N4861 [thread.barrier.class]/19)");
117+
"or the immediately preceding phase of the same barrier object (N4950 [thread.barrier.class]/19)");
118118
const ptrdiff_t _Arrival_value = _Arrival._Value & _Barrier_arrival_token_mask;
119119
_Arrival._Value = _Barrier_invalid_token;
120120
for (;;) {
121121
// TRANSITION, GH-1133: should be memory_order_acquire
122122
const ptrdiff_t _Current = _Val._Myval2._Current.load();
123123
_STL_VERIFY(_Current >= 0, "Invariant counter >= 0, possibly caused by preconditions violation "
124-
"(N4861 [thread.barrier.class]/12)");
124+
"(N4950 [thread.barrier.class]/12)");
125125
if ((_Current & _Barrier_arrival_token_mask) != _Arrival_value) {
126126
break;
127127
}
@@ -134,7 +134,7 @@ public:
134134
ptrdiff_t _Current = _Val._Myval2._Current.fetch_sub(_Barrier_value_step) - _Barrier_value_step;
135135
const ptrdiff_t _Arrival = _Current & _Barrier_arrival_token_mask;
136136
_STL_VERIFY(_Current >= 0, "Precondition: update is less than or equal to the expected count "
137-
"for the current barrier phase (N4861 [thread.barrier.class]/12)");
137+
"for the current barrier phase (N4950 [thread.barrier.class]/12)");
138138
if ((_Current & _Barrier_value_mask) == 0) {
139139
_Completion(_Current);
140140
return;
@@ -145,7 +145,7 @@ public:
145145
// TRANSITION, GH-1133: should be memory_order_acquire
146146
_Current = _Val._Myval2._Current.load();
147147
_STL_VERIFY(_Current >= 0, "Invariant counter >= 0, possibly caused by preconditions violation "
148-
"(N4861 [thread.barrier.class]/12)");
148+
"(N4950 [thread.barrier.class]/12)");
149149
if ((_Current & _Barrier_arrival_token_mask) != _Arrival) {
150150
break;
151151
}
@@ -156,7 +156,7 @@ public:
156156
const ptrdiff_t _Rem_count =
157157
_Val._Myval2._Total.fetch_sub(_Barrier_value_step, memory_order_relaxed) - _Barrier_value_step;
158158
_STL_VERIFY(_Rem_count >= 0, "Precondition: The expected count for the current barrier phase "
159-
"is greater than zero (N4861 [thread.barrier.class]/24) "
159+
"is greater than zero (N4950 [thread.barrier.class]/24) "
160160
"(checked initial expected count, which is not less than the current)");
161161
(void) arrive(1);
162162
}
@@ -166,7 +166,7 @@ private:
166166
const ptrdiff_t _Rem_count = _Val._Myval2._Total.load(memory_order_relaxed);
167167
_STL_VERIFY(_Rem_count >= 0, "Invariant: initial expected count less than zero, "
168168
"possibly caused by preconditions violation "
169-
"(N4861 [thread.barrier.class]/24)");
169+
"(N4950 [thread.barrier.class]/24)");
170170
_Val._Get_first()();
171171
const ptrdiff_t _New_phase_count = _Rem_count | ((_Current + 1) & _Barrier_arrival_token_mask);
172172
// TRANSITION, GH-1133: should be memory_order_release

stl/inc/bit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ _NODISCARD constexpr _Ty bit_ceil(const _Ty _Val) noexcept /* strengthened */ {
9999

100100
if constexpr (sizeof(_Ty) < sizeof(unsigned int)) { // for types subject to integral promotion
101101
if (_STD is_constant_evaluated()) {
102-
// Because N4892 [expr.shift]/1 "integral promotions are performed"
102+
// Because N4950 [expr.shift]/1 "integral promotions are performed"
103103
// the compiler will not generate a compile time error for
104104
// uint8_t{1} << 8
105105
// or
106106
// uint16_t{1} << 16
107-
// so we must manually enforce N4892 [bit.pow.two]/5, 8:
107+
// so we must manually enforce N4950 [bit.pow.two]/5, 8:
108108
// "Preconditions: N is representable as a value of type T."
109109
// "Remarks: A function call expression that violates the precondition in the Preconditions: element
110110
// is not a core constant expression (7.7)."

stl/inc/charconv

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ _NODISCARD _CONSTEXPR23 from_chars_result _Integer_from_chars(
304304
}
305305
}
306306

307-
_Raw_value = static_cast<_RawTy>(_Value); // implementation-defined for negative, N4713 7.8 [conv.integral]/3
307+
_Raw_value = static_cast<_RawTy>(_Value); // congruent to _Value modulo 2^N for negative, N4950 [conv.integral]/3
308308

309309
return {_Next, errc{}};
310310
}
@@ -369,24 +369,27 @@ _EXPORT_STD _CONSTEXPR23 from_chars_result from_chars(const char* const _First,
369369
// array is not necessary: all operations on the _Big_integer_flt type are carefully written to only access elements at
370370
// indices [0, _Myused), and all operations correctly update _Myused as the utilized size increases.
371371

372-
// _Big_integer_flt _Xval{}; is direct-list-initialization (N4750 11.6.4 [dcl.init.list]/1).
373-
// N4750 11.6.4 [dcl.init.list]/3.5:
372+
// _Big_integer_flt _Xval{}; is direct-list-initialization (N4950 [dcl.init.list]/1).
373+
// N4950 [dcl.init.list]/3.5:
374374
// "Otherwise, if the initializer list has no elements and T is a class type with a default constructor,
375375
// the object is value-initialized."
376-
// N4750 11.6 [dcl.init]/8, /8.1:
376+
// N4950 [dcl.init.general]/9, /9.1, /9.1.1:
377377
// "To value-initialize an object of type T means:
378-
// - if T is a (possibly cv-qualified) class type (Clause 12) with either no default constructor (15.1)
379-
// or a default constructor that is user-provided or deleted, then the object is default-initialized;"
380-
// N4750 11.6 [dcl.init]/7, /7.1:
378+
// - if T is a (possibly cv-qualified) class type ([class]), then
379+
// - if T has either no default constructor ([class.default.ctor]) or a default constructor
380+
// that is user-provided or deleted, then the object is default-initialized;"
381+
// N4950 [dcl.init.general]/7, /7.1:
381382
// "To default-initialize an object of type T means:
382-
// - If T is a (possibly cv-qualified) class type (Clause 12), constructors are considered. The applicable constructors
383-
// are enumerated (16.3.1.3), and the best one for the initializer () is chosen through overload resolution (16.3).
383+
// - If T is a (possibly cv-qualified) class type ([class]), constructors are considered. The applicable constructors
384+
// are enumerated ([over.match.ctor]), and the best one for the initializer () is chosen through overload resolution
385+
// ([over.match]).
384386
// The constructor thus selected is called, with an empty argument list, to initialize the object."
385-
// N4750 15.6.2 [class.base.init]/9, /9.3:
386-
// "In a non-delegating constructor, if a given potentially constructed subobject is not designated by a
387-
// mem-initializer-id (including the case where there is no mem-initializer-list because the constructor has no
388-
// ctor-initializer), then [...] - otherwise, the entity is default-initialized (11.6)."
389-
// N4750 11.6 [dcl.init]/7, /7.2, /7.3:
387+
// N4950 [class.base.init]/9, /9.3:
388+
// "In a non-delegating constructor other than an implicitly-defined copy/move constructor ([class.copy.ctor]),
389+
// if a given potentially constructed subobject is not designated by a mem-initializer-id (including the case
390+
// where there is no mem-initializer-list because the constructor has no ctor-initializer), then [...]
391+
// - otherwise, the entity is default-initialized ([dcl.init])."
392+
// N4950 [dcl.init.general]/7, /7.2, /7.3:
390393
// "To default-initialize an object of type T means: [...]
391394
// - If T is an array type, each element is default-initialized.
392395
// - Otherwise, no initialization is performed."
@@ -1651,7 +1654,7 @@ _NODISCARD from_chars_result _Ordinary_floating_from_chars(const char* const _Fi
16511654
constexpr int _Maximum_temporary_decimal_exponent = 5200;
16521655
constexpr int _Minimum_temporary_decimal_exponent = -5200;
16531656

1654-
if (_Fmt != chars_format::fixed // N4713 23.20.3 [charconv.from.chars]/7.3
1657+
if (_Fmt != chars_format::fixed // N4950 [charconv.from.chars]/6.3
16551658
// "if fmt has chars_format::fixed set but not chars_format::scientific,
16561659
// the optional exponent part shall not appear"
16571660
&& _Next != _Last && (static_cast<unsigned char>(*_Next) | 0x20) == _Exponent_prefix) { // found exponent prefix
@@ -1690,7 +1693,7 @@ _NODISCARD from_chars_result _Ordinary_floating_from_chars(const char* const _Fi
16901693
const char* const _Exponent_end = _Next;
16911694

16921695
if (_Fmt == chars_format::scientific
1693-
&& _Frac_end == _Exponent_end) { // N4713 23.20.3 [charconv.from.chars]/7.2
1696+
&& _Frac_end == _Exponent_end) { // N4950 [charconv.from.chars]/6.2
16941697
// "if fmt has chars_format::scientific set but not chars_format::fixed,
16951698
// the otherwise optional exponent part shall appear"
16961699
return {_First, errc::invalid_argument};

0 commit comments

Comments
 (0)