From a5910024dc41f375fd392ce4c567cbf29de95adf Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 25 Oct 2022 04:22:10 -0700 Subject: [PATCH 1/2] Add workaround for Boost. --- stl/inc/system_error | 5 +++++ .../GH_003119_error_category_ctor/test.compile.pass.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/stl/inc/system_error b/stl/inc/system_error index 77f6744e3c..7861dd8e65 100644 --- a/stl/inc/system_error +++ b/stl/inc/system_error @@ -131,6 +131,11 @@ protected: public: constexpr explicit _Addr_storage(const uintptr_t _Addr_num) noexcept : _Num(_Addr_num) {} constexpr explicit _Addr_storage(error_category* const _Addr_ptr) noexcept : _Ptr(_Addr_ptr) {} + + // TRANSITION: As of Boost 1.80.0, boost::system::detail::std_category assigns to _Addr. + constexpr void operator=(const uintptr_t _Addr_num) noexcept { + _Num = _Addr_num; + } }; static_assert(sizeof(_Addr_storage) == sizeof(uintptr_t) && alignof(_Addr_storage) == alignof(uintptr_t), "Unsupported platform"); diff --git a/tests/std/tests/GH_003119_error_category_ctor/test.compile.pass.cpp b/tests/std/tests/GH_003119_error_category_ctor/test.compile.pass.cpp index 2ef9789508..62cc884bb7 100644 --- a/tests/std/tests/GH_003119_error_category_ctor/test.compile.pass.cpp +++ b/tests/std/tests/GH_003119_error_category_ctor/test.compile.pass.cpp @@ -16,6 +16,11 @@ struct meow_category : error_category { string message(int) const override { return "meow"; } + + // TRANSITION: As of Boost 1.80.0, boost::system::detail::std_category assigns to _Addr. + void test_workaround_for_non_standard_code(const unsigned int val) noexcept { + _Addr = val; + } }; #if _HAS_CXX20 From 3e0af0c9f8eac8468e78a5f0a8ce3c12f21097c9 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 25 Oct 2022 10:40:47 -0700 Subject: [PATCH 2/2] Fix return type. --- stl/inc/system_error | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stl/inc/system_error b/stl/inc/system_error index 7861dd8e65..1387816062 100644 --- a/stl/inc/system_error +++ b/stl/inc/system_error @@ -133,8 +133,9 @@ protected: constexpr explicit _Addr_storage(error_category* const _Addr_ptr) noexcept : _Ptr(_Addr_ptr) {} // TRANSITION: As of Boost 1.80.0, boost::system::detail::std_category assigns to _Addr. - constexpr void operator=(const uintptr_t _Addr_num) noexcept { + constexpr _Addr_storage& operator=(const uintptr_t _Addr_num) noexcept { _Num = _Addr_num; + return *this; } }; static_assert(sizeof(_Addr_storage) == sizeof(uintptr_t) && alignof(_Addr_storage) == alignof(uintptr_t),