Skip to content

Commit 58f6266

Browse files
committed
Merge branch 'master' into pr1005
... to fix merge conflict in `tests/std/test.lst`.
2 parents 26cfc86 + d531112 commit 58f6266

File tree

27 files changed

+514
-355
lines changed

27 files changed

+514
-355
lines changed

stl/inc/algorithm

Lines changed: 189 additions & 131 deletions
Large diffs are not rendered by default.

stl/inc/atomic

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ struct _Atomic_storage<_Ty, 8> { // lock-free using 8-byte intrinsics
728728
return reinterpret_cast<_Ty&>(_As_bytes);
729729
}
730730

731-
#ifdef _M_IX86
731+
#if defined(_M_IX86) && defined(__clang__) // TRANSITION, LLVM-46595
732732
_Ty exchange(const _Ty _Value, const memory_order _Order = memory_order_seq_cst) noexcept {
733733
// exchange with (effectively) sequential consistency
734734
_Ty _Temp{load()};
@@ -737,15 +737,15 @@ struct _Atomic_storage<_Ty, 8> { // lock-free using 8-byte intrinsics
737737

738738
return _Temp;
739739
}
740-
#else // ^^^ _M_IX86 / !_M_IX86 vvv
740+
#else // ^^^ defined(_M_IX86) && defined(__clang__), LLVM-46595 / !defined(_M_IX86) || !defined(__clang__) vvv
741741
_Ty exchange(const _Ty _Value, const memory_order _Order = memory_order_seq_cst) noexcept {
742742
// exchange with given memory order
743743
long long _As_bytes;
744744
_ATOMIC_CHOOSE_INTRINSIC(_Order, _As_bytes, _InterlockedExchange64, _Atomic_address_as<long long>(_Storage),
745745
_Atomic_reinterpret_as<long long>(_Value));
746746
return reinterpret_cast<_Ty&>(_As_bytes);
747747
}
748-
#endif // _M_IX86
748+
#endif // ^^^ !defined(_M_IX86) || !defined(__clang__) ^^^
749749

750750
bool compare_exchange_strong(_Ty& _Expected, const _Ty _Desired,
751751
const memory_order _Order = memory_order_seq_cst) noexcept { // CAS with given memory order
@@ -1067,7 +1067,7 @@ struct _Atomic_integral<_Ty, 8> : _Atomic_storage<_Ty> { // atomic integral oper
10671067
using _Base::_Base;
10681068
#endif // ^^^ no workaround ^^^
10691069

1070-
#ifdef _M_IX86
1070+
#if defined(_M_IX86) && defined(__clang__) // TRANSITION, LLVM-46595
10711071
_Ty fetch_add(const _Ty _Operand, const memory_order _Order = memory_order_seq_cst) noexcept {
10721072
// effectively sequential consistency
10731073
_Ty _Temp{this->load()};
@@ -1120,7 +1120,7 @@ struct _Atomic_integral<_Ty, 8> : _Atomic_storage<_Ty> { // atomic integral oper
11201120
return fetch_add(static_cast<_Ty>(-1)) - static_cast<_Ty>(1);
11211121
}
11221122

1123-
#else // ^^^ _M_IX86 / !_M_IX86 vvv
1123+
#else // ^^^ defined(_M_IX86) && defined(__clang__), LLVM-46595 / !defined(_M_IX86) || !defined(__clang__) vvv
11241124
_Ty fetch_add(const _Ty _Operand, const memory_order _Order = memory_order_seq_cst) noexcept {
11251125
long long _Result;
11261126
_ATOMIC_CHOOSE_INTRINSIC(_Order, _Result, _InterlockedExchangeAdd64,
@@ -1170,7 +1170,7 @@ struct _Atomic_integral<_Ty, 8> : _Atomic_storage<_Ty> { // atomic integral oper
11701170
_Ty operator--() noexcept {
11711171
return static_cast<_Ty>(_InterlockedDecrement64(_Atomic_address_as<long long>(this->_Storage)));
11721172
}
1173-
#endif // _M_IX86
1173+
#endif // ^^^ !defined(_M_IX86) || !defined(__clang__) ^^^
11741174
};
11751175

11761176
#if 1 // TRANSITION, ABI

stl/inc/concepts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ concept _Boolean_testable_impl = convertible_to<_Ty, bool>;
199199

200200
template <class _Ty>
201201
concept _Boolean_testable = _Boolean_testable_impl<_Ty>
202-
&& requires (_Ty&& __t) {
202+
&& requires(_Ty&& __t) {
203203
{ !static_cast<_Ty&&>(__t) } -> _Boolean_testable_impl;
204204
};
205205

stl/inc/execution

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,7 +1871,7 @@ struct _Static_partitioned_mismatch2 {
18711871
template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Pr, _Enable_if_execution_policy_t<_ExPo> /* = 0 */>
18721872
_NODISCARD pair<_FwdIt1, _FwdIt2> mismatch(
18731873
_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _Pr _Pred) noexcept /* terminates */ {
1874-
// return [_First1, _Last1)/[_First2, ...) mismatch using _Pred
1874+
// return [_First1, _Last1)/[_First2, ...) mismatch
18751875
_REQUIRE_PARALLEL_ITERATOR(_FwdIt1);
18761876
_REQUIRE_PARALLEL_ITERATOR(_FwdIt2);
18771877
_Adl_verify_range(_First1, _Last1);
@@ -1913,7 +1913,7 @@ _NODISCARD pair<_FwdIt1, _FwdIt2> mismatch(
19131913
template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Pr, _Enable_if_execution_policy_t<_ExPo> /* = 0 */>
19141914
_NODISCARD pair<_FwdIt1, _FwdIt2> mismatch(
19151915
_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred) noexcept /* terminates */ {
1916-
// return [_First1, _Last1)/[_First2, _Last2) mismatch using _Pred
1916+
// return [_First1, _Last1)/[_First2, _Last2) mismatch
19171917
_REQUIRE_PARALLEL_ITERATOR(_FwdIt1);
19181918
_REQUIRE_PARALLEL_ITERATOR(_FwdIt2);
19191919
_Adl_verify_range(_First1, _Last1);
@@ -1991,7 +1991,7 @@ struct _Static_partitioned_equal2 {
19911991
template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Pr, _Enable_if_execution_policy_t<_ExPo> /* = 0 */>
19921992
_NODISCARD bool equal(_ExPo&&, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2, _Pr _Pred) noexcept
19931993
/* terminates */ {
1994-
// compare [_First1, _Last1) to [_First2, ...) using _Pred
1994+
// compare [_First1, _Last1) to [_First2, ...)
19951995
_REQUIRE_PARALLEL_ITERATOR(_FwdIt1);
19961996
_REQUIRE_PARALLEL_ITERATOR(_FwdIt2);
19971997
_Adl_verify_range(_First1, _Last1);
@@ -2024,7 +2024,7 @@ _NODISCARD bool equal(_ExPo&&, const _FwdIt1 _First1, const _FwdIt1 _Last1, cons
20242024
template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Pr, _Enable_if_execution_policy_t<_ExPo> /* = 0 */>
20252025
_NODISCARD bool equal(_ExPo&&, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2, const _FwdIt2 _Last2,
20262026
_Pr _Pred) noexcept /* terminates */ {
2027-
// compare [_First1, _Last1) to [_First2, _Last2) using _Pred
2027+
// compare [_First1, _Last1) to [_First2, _Last2)
20282028
_REQUIRE_PARALLEL_ITERATOR(_FwdIt1);
20292029
_REQUIRE_PARALLEL_ITERATOR(_FwdIt2);
20302030
_Adl_verify_range(_First1, _Last1);
@@ -2740,7 +2740,7 @@ struct _Sort_operation { // context for background threads
27402740

27412741
template <class _ExPo, class _RanIt, class _Pr, _Enable_if_execution_policy_t<_ExPo> /* = 0 */>
27422742
void sort(_ExPo&&, const _RanIt _First, const _RanIt _Last, _Pr _Pred) noexcept /* terminates */ {
2743-
// order [_First, _Last), using _Pred
2743+
// order [_First, _Last)
27442744
_Adl_verify_range(_First, _Last);
27452745
const auto _UFirst = _Get_unwrapped(_First);
27462746
const auto _ULast = _Get_unwrapped(_Last);
@@ -2998,7 +2998,7 @@ struct _Static_partitioned_stable_sort3 {
29982998

29992999
template <class _ExPo, class _BidIt, class _Pr, _Enable_if_execution_policy_t<_ExPo> /* = 0 */>
30003000
void stable_sort(_ExPo&&, const _BidIt _First, const _BidIt _Last, _Pr _Pred) noexcept /* terminates */ {
3001-
// sort preserving order of equivalents, using _Pred
3001+
// sort preserving order of equivalents
30023002
_Adl_verify_range(_First, _Last);
30033003
const auto _UFirst = _Get_unwrapped(_First);
30043004
const auto _ULast = _Get_unwrapped(_Last);
@@ -3314,7 +3314,7 @@ struct _Static_partitioned_is_heap_until {
33143314

33153315
template <class _ExPo, class _RanIt, class _Pr, _Enable_if_execution_policy_t<_ExPo> /* = 0 */>
33163316
_NODISCARD _RanIt is_heap_until(_ExPo&&, _RanIt _First, _RanIt _Last, _Pr _Pred) noexcept /* terminates */ {
3317-
// find extent of range that is a heap ordered by _Pred
3317+
// find extent of range that is a heap
33183318
_REQUIRE_PARALLEL_ITERATOR(_RanIt);
33193319
_Adl_verify_range(_First, _Last);
33203320
const auto _UFirst = _Get_unwrapped(_First);
@@ -3910,7 +3910,7 @@ template <class _ExPo, class _FwdIt1, class _FwdIt2, class _FwdIt3, class _Pr,
39103910
_Enable_if_execution_policy_t<_ExPo> /* = 0 */>
39113911
_FwdIt3 set_intersection(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _FwdIt3 _Dest,
39123912
_Pr _Pred) noexcept /* terminates */ {
3913-
// AND sets [_First1, _Last1) and [_First2, _Last2), using _Pred
3913+
// AND sets [_First1, _Last1) and [_First2, _Last2)
39143914
_REQUIRE_PARALLEL_ITERATOR(_FwdIt1);
39153915
_REQUIRE_PARALLEL_ITERATOR(_FwdIt2);
39163916
_REQUIRE_PARALLEL_ITERATOR(_FwdIt3);
@@ -4001,7 +4001,7 @@ template <class _ExPo, class _FwdIt1, class _FwdIt2, class _FwdIt3, class _Pr,
40014001
_Enable_if_execution_policy_t<_ExPo> /* = 0 */>
40024002
_FwdIt3 set_difference(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _FwdIt3 _Dest,
40034003
_Pr _Pred) noexcept /* terminates */ {
4004-
// take set [_First2, _Last2) from [_First1, _Last1), using _Pred
4004+
// take set [_First2, _Last2) from [_First1, _Last1)
40054005
_REQUIRE_PARALLEL_ITERATOR(_FwdIt1);
40064006
_REQUIRE_PARALLEL_ITERATOR(_FwdIt2);
40074007
_REQUIRE_PARALLEL_ITERATOR(_FwdIt3);

stl/inc/forward_list

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,12 +1342,12 @@ private:
13421342
}
13431343

13441344
public:
1345-
void sort() { // order sequence, using operator<
1345+
void sort() { // order sequence
13461346
_Scary_val::_Sort(_Mypair._Myval2._Before_head(), less<>{});
13471347
}
13481348

13491349
template <class _Pr2>
1350-
void sort(_Pr2 _Pred) { // order sequence, using _Pred
1350+
void sort(_Pr2 _Pred) { // order sequence
13511351
_Scary_val::_Sort(_Mypair._Myval2._Before_head(), _Pass_fn(_Pred));
13521352
}
13531353

stl/inc/limits

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,6 @@ _NODISCARD constexpr int _Countr_zero_fallback(const _Ty _Val) noexcept {
10411041
}
10421042

10431043
#if defined(_M_IX86) || defined(_M_X64)
1044-
10451044
// TRANSITION, VS 2019 16.8 Preview 1, intrin0.h will declare _tzcnt*
10461045
extern "C" {
10471046
extern int __isa_available;
@@ -1068,7 +1067,7 @@ _NODISCARD int _Checked_x86_x64_countr_zero(const _Ty _Val) noexcept {
10681067
}
10691068
#endif // __AVX2__
10701069

1071-
if constexpr (_Digits <= 32) {
1070+
if _CONSTEXPR_IF (_Digits <= 32) {
10721071
// Intended widening to int. This operation means that a narrow 0 will widen
10731072
// to 0xFFFF....FFFF0... instead of 0. We need this to avoid counting all the zeros
10741073
// of the wider type.

stl/inc/list

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ public:
555555

556556
template <class _Pr2>
557557
static _Nodeptr _Sort(_Nodeptr& _First, const size_type _Size, _Pr2 _Pred) {
558-
// order [_First, _Last), using _Pred, return _First + _Size
558+
// order [_First, _Last), return _First + _Size
559559
switch (_Size) {
560560
case 0:
561561
return _First;
@@ -1706,12 +1706,12 @@ private:
17061706
}
17071707

17081708
public:
1709-
void sort() { // order sequence, using operator<
1709+
void sort() { // order sequence
17101710
sort(less<>());
17111711
}
17121712

17131713
template <class _Pr2>
1714-
void sort(_Pr2 _Pred) { // order sequence, using _Pred
1714+
void sort(_Pr2 _Pred) { // order sequence
17151715
auto& _My_data = _Mypair._Myval2;
17161716
_Scary_val::_Sort(_My_data._Myhead->_Next, _My_data._Mysize, _Pass_fn(_Pred));
17171717
}

stl/inc/memory

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ _NODISCARD shared_ptr<_Ty1> dynamic_pointer_cast(const shared_ptr<_Ty2>& _Other)
13861386
return shared_ptr<_Ty1>(_Other, _Ptr);
13871387
}
13881388

1389-
return shared_ptr<_Ty1>();
1389+
return {};
13901390
}
13911391

13921392
template <class _Ty1, class _Ty2>
@@ -1398,7 +1398,7 @@ _NODISCARD shared_ptr<_Ty1> dynamic_pointer_cast(shared_ptr<_Ty2>&& _Other) noex
13981398
return shared_ptr<_Ty1>(_STD move(_Other), _Ptr);
13991399
}
14001400

1401-
return shared_ptr<_Ty1>();
1401+
return {};
14021402
}
14031403
#else // _CPPRTTI
14041404
template <class _Ty1, class _Ty2>
@@ -2730,7 +2730,7 @@ _NODISCARD bool operator<(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<
27302730
using _Ptr1 = typename unique_ptr<_Ty1, _Dx1>::pointer;
27312731
using _Ptr2 = typename unique_ptr<_Ty2, _Dx2>::pointer;
27322732
using _Common = common_type_t<_Ptr1, _Ptr2>;
2733-
return less<_Common>()(_Left.get(), _Right.get());
2733+
return less<_Common>{}(_Left.get(), _Right.get());
27342734
}
27352735

27362736
template <class _Ty1, class _Dx1, class _Ty2, class _Dx2>
@@ -2771,13 +2771,13 @@ _NODISCARD bool operator!=(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right)
27712771
template <class _Ty, class _Dx>
27722772
_NODISCARD bool operator<(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right) {
27732773
using _Ptr = typename unique_ptr<_Ty, _Dx>::pointer;
2774-
return less<_Ptr>()(_Left.get(), _Right);
2774+
return less<_Ptr>{}(_Left.get(), _Right);
27752775
}
27762776

27772777
template <class _Ty, class _Dx>
27782778
_NODISCARD bool operator<(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right) {
27792779
using _Ptr = typename unique_ptr<_Ty, _Dx>::pointer;
2780-
return less<_Ptr>()(_Left, _Right.get());
2780+
return less<_Ptr>{}(_Left, _Right.get());
27812781
}
27822782

27832783
template <class _Ty, class _Dx>

stl/inc/regex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public:
336336
unsigned int _Ix = 0;
337337
for (; _Names[_Ix]._Get<_Elem>(); ++_Ix) {
338338
if (_STD equal(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Names[_Ix]._Get<_Elem>(),
339-
_Names[_Ix]._Get<_Elem>() + _Names[_Ix]._Len, _Cmp_icase<_Regex_traits<_Elem>>(*this))) {
339+
_Names[_Ix]._Get<_Elem>() + _Names[_Ix]._Len, _Cmp_icase<_Regex_traits<_Elem>>{*this})) {
340340
break;
341341
}
342342
}
@@ -1822,13 +1822,13 @@ public:
18221822
template <class _InIt>
18231823
basic_regex(_InIt _First, _InIt _Last, flag_type _Flags) : _Rep(nullptr) {
18241824
_Adl_verify_range(_First, _Last);
1825-
_Reset(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Flags, _Iter_cat_t<_InIt>());
1825+
_Reset(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Flags, _Iter_cat_t<_InIt>{});
18261826
}
18271827

18281828
template <class _InIt>
18291829
basic_regex(_InIt _First, _InIt _Last) : _Rep(nullptr) {
18301830
_Adl_verify_range(_First, _Last);
1831-
_Reset(_Get_unwrapped(_First), _Get_unwrapped(_Last), regex_constants::ECMAScript, _Iter_cat_t<_InIt>());
1831+
_Reset(_Get_unwrapped(_First), _Get_unwrapped(_Last), regex_constants::ECMAScript, _Iter_cat_t<_InIt>{});
18321832
}
18331833

18341834
basic_regex(const basic_regex& _Right)
@@ -1939,7 +1939,7 @@ public:
19391939
template <class _InIt>
19401940
basic_regex& assign(_InIt _First, _InIt _Last, flag_type _Flags = regex_constants::ECMAScript) {
19411941
_Adl_verify_range(_First, _Last);
1942-
_Reset(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Flags, _Iter_cat_t<_InIt>());
1942+
_Reset(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Flags, _Iter_cat_t<_InIt>{});
19431943
return *this;
19441944
}
19451945

@@ -3292,11 +3292,11 @@ _BidIt1 _Compare(_BidIt1 _Begin1, _BidIt1 _End1, _BidIt2 _Begin2, _BidIt2 _End2,
32923292
regex_constants::syntax_option_type _Sflags) { // compare character ranges
32933293
_BidIt1 _Res = _End1;
32943294
if (_Sflags & regex_constants::icase) {
3295-
_Res = _Cmp_chrange(_Begin1, _End1, _Begin2, _End2, _Cmp_icase<_RxTraits>(_Traits));
3295+
_Res = _Cmp_chrange(_Begin1, _End1, _Begin2, _End2, _Cmp_icase<_RxTraits>{_Traits});
32963296
} else if (_Sflags & regex_constants::collate) {
3297-
_Res = _Cmp_chrange(_Begin1, _End1, _Begin2, _End2, _Cmp_collate<_RxTraits>(_Traits));
3297+
_Res = _Cmp_chrange(_Begin1, _End1, _Begin2, _End2, _Cmp_collate<_RxTraits>{_Traits});
32983298
} else {
3299-
_Res = _Cmp_chrange(_Begin1, _End1, _Begin2, _End2, _Cmp_cs<_RxTraits>());
3299+
_Res = _Cmp_chrange(_Begin1, _End1, _Begin2, _End2, _Cmp_cs<_RxTraits>{});
33003300
}
33013301

33023302
return _Res;

stl/inc/utility

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ _STD_BEGIN
3131
template <class _Ty, class _Pr>
3232
_NODISCARD constexpr const _Ty&(max)(const _Ty& _Left, const _Ty& _Right, _Pr _Pred) noexcept(
3333
noexcept(_Pred(_Left, _Right))) /* strengthened */ {
34-
// return larger of _Left and _Right using _Pred
34+
// return larger of _Left and _Right
3535
return _Pred(_Left, _Right) ? _Right : _Left;
3636
}
3737

@@ -55,7 +55,7 @@ _NODISCARD constexpr _Ty(max)(initializer_list<_Ty>); // implemented in <algorit
5555
template <class _Ty, class _Pr>
5656
_NODISCARD constexpr const _Ty&(min)(const _Ty& _Left, const _Ty& _Right, _Pr _Pred) noexcept(
5757
noexcept(_Pred(_Right, _Left))) /* strengthened */ {
58-
// return smaller of _Left and _Right using _Pred
58+
// return smaller of _Left and _Right
5959
return _Pred(_Right, _Left) ? _Right : _Left;
6060
}
6161

@@ -522,7 +522,7 @@ template <size_t _Idx, class _Ty1, class _Ty2>
522522
_NODISCARD constexpr tuple_element_t<_Idx, pair<_Ty1, _Ty2>>& get(
523523
pair<_Ty1, _Ty2>& _Pr) noexcept { // get reference to element at _Idx in pair _Pr
524524
using _Rtype = tuple_element_t<_Idx, pair<_Ty1, _Ty2>>&;
525-
return _Pair_get<_Rtype>(_Pr, integral_constant<size_t, _Idx>());
525+
return _Pair_get<_Rtype>(_Pr, integral_constant<size_t, _Idx>{});
526526
}
527527

528528
template <class _Ty1, class _Ty2>
@@ -539,7 +539,7 @@ template <size_t _Idx, class _Ty1, class _Ty2>
539539
_NODISCARD constexpr const tuple_element_t<_Idx, pair<_Ty1, _Ty2>>& get(
540540
const pair<_Ty1, _Ty2>& _Pr) noexcept { // get const reference to element at _Idx in pair _Pr
541541
using _Ctype = const tuple_element_t<_Idx, pair<_Ty1, _Ty2>>&;
542-
return _Pair_get<_Ctype>(_Pr, integral_constant<size_t, _Idx>());
542+
return _Pair_get<_Ctype>(_Pr, integral_constant<size_t, _Idx>{});
543543
}
544544

545545
template <class _Ty1, class _Ty2>

0 commit comments

Comments
 (0)