From 3763a231925a9b62b75e3cd4af290e73f9b6dc25 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Thu, 10 Sep 2020 21:52:53 -0700 Subject: [PATCH 1/2] Workaround VSO-1132105 in --- stl/inc/ranges | 62 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/stl/inc/ranges b/stl/inc/ranges index 1f050170e0c..564d9fd198e 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -76,8 +76,13 @@ namespace ranges { // clang-format off template requires _Can_compose<_Derived, _Other> - constexpr auto operator|(_Base<_Other>&& __r) && noexcept( - noexcept(_Pipeline{static_cast<_Derived&&>(*this), static_cast<_Other&&>(__r)})) { + constexpr auto operator|(_Base<_Other>&& __r) && +#ifdef __EDG__ // TRANSITION, VSO-1132105 + noexcept(noexcept(_Pipeline{_STD declval<_Derived>(), _STD declval<_Other>()})) +#else // ^^^ workaround / no workaround vvv + noexcept(noexcept(_Pipeline{static_cast<_Derived&&>(*this), static_cast<_Other&&>(__r)})) +#endif // TRANSITION, VSO-1132105 + { // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); @@ -87,8 +92,13 @@ namespace ranges { // clang-format off template requires _Can_compose<_Derived, const _Other&> - constexpr auto operator|(const _Base<_Other>& __r) && noexcept(noexcept( - _Pipeline{static_cast<_Derived&&>(*this), static_cast(__r)})) { + constexpr auto operator|(const _Base<_Other>& __r) && +#ifdef __EDG__ // TRANSITION, VSO-1132105 + noexcept(noexcept(_Pipeline{_STD declval<_Derived>(), _STD declval()})) +#else // ^^^ workaround / no workaround vvv + noexcept(noexcept(_Pipeline{static_cast<_Derived&&>(*this), static_cast(__r)})) +#endif // TRANSITION, VSO-1132105 + { // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); @@ -98,8 +108,13 @@ namespace ranges { // clang-format off template requires _Can_compose - constexpr auto operator|(_Base<_Other>&& __r) const& noexcept( - noexcept(_Pipeline{static_cast(*this), static_cast<_Other&&>(__r)})) { + constexpr auto operator|(_Base<_Other>&& __r) const& +#ifdef __EDG__ // TRANSITION, VSO-1132105 + noexcept(noexcept(_Pipeline{_STD declval(), _STD declval<_Other>()})) +#else // ^^^ workaround / no workaround vvv + noexcept(noexcept(_Pipeline{static_cast(*this), static_cast<_Other&&>(__r)})) +#endif // TRANSITION, VSO-1132105 + { // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); @@ -109,8 +124,13 @@ namespace ranges { // clang-format off template requires _Can_compose - constexpr auto operator|(const _Base<_Other>& __r) const& noexcept(noexcept( - _Pipeline{static_cast(*this), static_cast(__r)})) { + constexpr auto operator|(const _Base<_Other>& __r) const& +#ifdef __EDG__ // TRANSITION, VSO-1132105 + noexcept(noexcept(_Pipeline{_STD declval(), _STD declval()})) +#else // ^^^ workaround / no workaround vvv + noexcept(noexcept(_Pipeline{static_cast(*this), static_cast(__r)})) +#endif // TRANSITION, VSO-1132105 + { // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); @@ -118,14 +138,24 @@ namespace ranges { } template <_Can_pipe _Left> - friend constexpr auto operator|(_Left&& __l, const _Base& __r) noexcept( - noexcept(static_cast(__r)(_STD forward<_Left>(__l)))) { + friend constexpr auto operator|(_Left&& __l, const _Base& __r) +#ifdef __EDG__ // TRANSITION, VSO-1132105 + noexcept(noexcept(_STD declval()(_STD declval<_Left>()))) +#else // ^^^ workaround / no workaround vvv + noexcept(noexcept(static_cast(__r)(_STD forward<_Left>(__l)))) +#endif // TRANSITION, VSO-1132105 + { return static_cast(__r)(_STD forward<_Left>(__l)); } template <_Can_pipe<_Derived> _Left> - friend constexpr auto operator|(_Left&& __l, _Base&& __r) noexcept( - noexcept(static_cast<_Derived&&>(__r)(_STD forward<_Left>(__l)))) { + friend constexpr auto operator|(_Left&& __l, _Base&& __r) +#ifdef __EDG__ // TRANSITION, VSO-1132105 + noexcept(noexcept(_STD declval<_Derived>()(_STD declval<_Left>()))) +#else // ^^^ workaround / no workaround vvv + noexcept(noexcept(static_cast<_Derived&&>(__r)(_STD forward<_Left>(__l)))) +#endif // TRANSITION, VSO-1132105 + { return static_cast<_Derived&&>(__r)(_STD forward<_Left>(__l)); } }; @@ -432,9 +462,9 @@ namespace ranges { public: using optional<_Ty>::optional; - _Semiregular_box_copy() = default; + _Semiregular_box_copy() = default; _Semiregular_box_copy(const _Semiregular_box_copy&) = default; - _Semiregular_box_copy(_Semiregular_box_copy&&) = default; + _Semiregular_box_copy(_Semiregular_box_copy&&) = default; _Semiregular_box_copy& operator=(_Semiregular_box_copy&&) = default; _Semiregular_box_copy& operator=(const _Semiregular_box_copy& _That) noexcept( @@ -459,9 +489,9 @@ namespace ranges { public: using _Choose_semiregular_box_copy<_Ty>::_Choose_semiregular_box_copy; - _Semiregular_box_move() = default; + _Semiregular_box_move() = default; _Semiregular_box_move(const _Semiregular_box_move&) = default; - _Semiregular_box_move(_Semiregular_box_move&&) = default; + _Semiregular_box_move(_Semiregular_box_move&&) = default; _Semiregular_box_move& operator=(const _Semiregular_box_move&) = default; _Semiregular_box_move& operator=(_Semiregular_box_move&& _That) noexcept(is_nothrow_move_constructible_v<_Ty>) { From c3f60ee350861aedb4f46968624a16a06c8f3179 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Mon, 28 Sep 2020 21:49:26 -0700 Subject: [PATCH 2/2] Correctly mark workarounds for VSO-1222776 "EDG doesn't know that noexcept-specifiers of hidden friend functions are complete-class contexts" --- stl/inc/ranges | 48 ++++++++++++++---------------------------------- stl/inc/xutility | 8 ++++---- 2 files changed, 18 insertions(+), 38 deletions(-) diff --git a/stl/inc/ranges b/stl/inc/ranges index 564d9fd198e..c45349b6a5d 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -76,13 +76,8 @@ namespace ranges { // clang-format off template requires _Can_compose<_Derived, _Other> - constexpr auto operator|(_Base<_Other>&& __r) && -#ifdef __EDG__ // TRANSITION, VSO-1132105 - noexcept(noexcept(_Pipeline{_STD declval<_Derived>(), _STD declval<_Other>()})) -#else // ^^^ workaround / no workaround vvv - noexcept(noexcept(_Pipeline{static_cast<_Derived&&>(*this), static_cast<_Other&&>(__r)})) -#endif // TRANSITION, VSO-1132105 - { + constexpr auto operator|(_Base<_Other>&& __r) && noexcept( + noexcept(_Pipeline{static_cast<_Derived&&>(*this), static_cast<_Other&&>(__r)})) { // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); @@ -92,13 +87,8 @@ namespace ranges { // clang-format off template requires _Can_compose<_Derived, const _Other&> - constexpr auto operator|(const _Base<_Other>& __r) && -#ifdef __EDG__ // TRANSITION, VSO-1132105 - noexcept(noexcept(_Pipeline{_STD declval<_Derived>(), _STD declval()})) -#else // ^^^ workaround / no workaround vvv - noexcept(noexcept(_Pipeline{static_cast<_Derived&&>(*this), static_cast(__r)})) -#endif // TRANSITION, VSO-1132105 - { + constexpr auto operator|(const _Base<_Other>& __r) && noexcept( + noexcept(_Pipeline{static_cast<_Derived&&>(*this), static_cast(__r)})) { // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); @@ -108,13 +98,8 @@ namespace ranges { // clang-format off template requires _Can_compose - constexpr auto operator|(_Base<_Other>&& __r) const& -#ifdef __EDG__ // TRANSITION, VSO-1132105 - noexcept(noexcept(_Pipeline{_STD declval(), _STD declval<_Other>()})) -#else // ^^^ workaround / no workaround vvv - noexcept(noexcept(_Pipeline{static_cast(*this), static_cast<_Other&&>(__r)})) -#endif // TRANSITION, VSO-1132105 - { + constexpr auto operator|(_Base<_Other>&& __r) const& noexcept( + noexcept(_Pipeline{static_cast(*this), static_cast<_Other&&>(__r)})) { // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); @@ -124,13 +109,8 @@ namespace ranges { // clang-format off template requires _Can_compose - constexpr auto operator|(const _Base<_Other>& __r) const& -#ifdef __EDG__ // TRANSITION, VSO-1132105 - noexcept(noexcept(_Pipeline{_STD declval(), _STD declval()})) -#else // ^^^ workaround / no workaround vvv - noexcept(noexcept(_Pipeline{static_cast(*this), static_cast(__r)})) -#endif // TRANSITION, VSO-1132105 - { + constexpr auto operator|(const _Base<_Other>& __r) const& noexcept( + noexcept(_Pipeline{static_cast(*this), static_cast(__r)})) { // clang-format on _STL_INTERNAL_STATIC_ASSERT(derived_from<_Derived, _Base<_Derived>>); _STL_INTERNAL_STATIC_ASSERT(derived_from<_Other, _Base<_Other>>); @@ -139,22 +119,22 @@ namespace ranges { template <_Can_pipe _Left> friend constexpr auto operator|(_Left&& __l, const _Base& __r) -#ifdef __EDG__ // TRANSITION, VSO-1132105 - noexcept(noexcept(_STD declval()(_STD declval<_Left>()))) +#ifdef __EDG__ // TRANSITION, VSO-1222776 + noexcept(noexcept(_STD declval()(_STD forward<_Left>(__l)))) #else // ^^^ workaround / no workaround vvv noexcept(noexcept(static_cast(__r)(_STD forward<_Left>(__l)))) -#endif // TRANSITION, VSO-1132105 +#endif // TRANSITION, VSO-1222776 { return static_cast(__r)(_STD forward<_Left>(__l)); } template <_Can_pipe<_Derived> _Left> friend constexpr auto operator|(_Left&& __l, _Base&& __r) -#ifdef __EDG__ // TRANSITION, VSO-1132105 - noexcept(noexcept(_STD declval<_Derived>()(_STD declval<_Left>()))) +#ifdef __EDG__ // TRANSITION, VSO-1222776 + noexcept(noexcept(_STD declval<_Derived>()(_STD forward<_Left>(__l)))) #else // ^^^ workaround / no workaround vvv noexcept(noexcept(static_cast<_Derived&&>(__r)(_STD forward<_Left>(__l)))) -#endif // TRANSITION, VSO-1132105 +#endif // TRANSITION, VSO-1222776 { return static_cast<_Derived&&>(__r)(_STD forward<_Left>(__l)); } diff --git a/stl/inc/xutility b/stl/inc/xutility index f35a2ace52c..3b2645411ca 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -4117,22 +4117,22 @@ public: } _NODISCARD friend constexpr reference iter_move(const move_iterator& _It) -#ifdef __EDG__ // TRANSITION, VSO-1132105 +#ifdef __EDG__ // TRANSITION, VSO-1222776 noexcept(noexcept(_RANGES iter_move(_STD declval()))) #else // ^^^ workaround / no workaround vvv noexcept(noexcept(_RANGES iter_move(_It._Current))) -#endif // TRANSITION, VSO-1132105 +#endif // TRANSITION, VSO-1222776 { return _RANGES iter_move(_It._Current); } template _Iter2> friend constexpr void iter_swap(const move_iterator& _Left, const move_iterator<_Iter2>& _Right) -#ifdef __EDG__ // TRANSITION, VSO-1132105 +#ifdef __EDG__ // TRANSITION, VSO-1222776 noexcept(noexcept(_RANGES iter_swap(_STD declval(), _STD declval()))) #else // ^^^ workaround / no workaround vvv noexcept(noexcept(_RANGES iter_swap(_Left._Current, _Right.base()))) -#endif // TRANSITION, VSO-1132105 +#endif // TRANSITION, VSO-1222776 { _RANGES iter_swap(_Left._Current, _Right.base()); }