Skip to content

Commit

Permalink
Fix error_category regression with Boost.System (#3176)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanTLavavej committed Oct 26, 2022
1 parent 71d5417 commit 82837b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stl/inc/system_error
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ 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 _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),
"Unsupported platform");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82837b7

Please sign in to comment.