Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Centralize the friend decls for nested status codes #62

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion include/status-code/boost_error_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ namespace mixins
class _boost_error_code_domain final : public status_code_domain
{
template <class DomainType> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
using _base = status_code_domain;
using _error_code_type = boost::system::error_code;
using _error_category_type = boost::system::error_category;
Expand Down
1 change: 0 additions & 1 deletion include/status-code/com_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ using com_error = status_error<_com_code_domain>;
class _com_code_domain : public status_code_domain
{
template <class DomainType> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
using _base = status_code_domain;

//! Construct from a `HRESULT` error code
Expand Down
1 change: 0 additions & 1 deletion include/status-code/generic_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ namespace detail
class _generic_code_domain : public status_code_domain
{
template <class> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
using _base = status_code_domain;

public:
Expand Down
1 change: 0 additions & 1 deletion include/status-code/getaddrinfo_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ using getaddrinfo_error = status_error<_getaddrinfo_code_domain>;
class _getaddrinfo_code_domain : public status_code_domain
{
template <class DomainType> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
using _base = status_code_domain;

public:
Expand Down
1 change: 0 additions & 1 deletion include/status-code/http_status_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ namespace mixins
class _http_status_code_domain : public status_code_domain
{
template <class DomainType> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
using _base = status_code_domain;

public:
Expand Down
10 changes: 5 additions & 5 deletions include/status-code/nested_status_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,32 +96,32 @@ namespace detail
{
assert(code.domain() == *this);
const auto &c = static_cast<const _mycode &>(code); // NOLINT
return typename StatusCode::domain_type()._do_failure(c.value()->sc);
return static_cast<status_code_domain &&>(typename StatusCode::domain_type())._do_failure(c.value()->sc);
}
virtual bool _do_equivalent(const status_code<void> &code1, const status_code<void> &code2) const noexcept override // NOLINT
{
assert(code1.domain() == *this);
const auto &c1 = static_cast<const _mycode &>(code1); // NOLINT
return typename StatusCode::domain_type()._do_equivalent(c1.value()->sc, code2);
return static_cast<status_code_domain &&>(typename StatusCode::domain_type())._do_equivalent(c1.value()->sc, code2);
}
virtual generic_code _generic_code(const status_code<void> &code) const noexcept override // NOLINT
{
assert(code.domain() == *this);
const auto &c = static_cast<const _mycode &>(code); // NOLINT
return typename StatusCode::domain_type()._generic_code(c.value()->sc);
return static_cast<status_code_domain &&>(typename StatusCode::domain_type())._generic_code(c.value()->sc);
}
virtual string_ref _do_message(const status_code<void> &code) const noexcept override // NOLINT
{
assert(code.domain() == *this);
const auto &c = static_cast<const _mycode &>(code); // NOLINT
return typename StatusCode::domain_type()._do_message(c.value()->sc);
return static_cast<status_code_domain &&>(typename StatusCode::domain_type())._do_message(c.value()->sc);
}
#if defined(_CPPUNWIND) || defined(__EXCEPTIONS) || defined(STANDARDESE_IS_IN_THE_HOUSE)
SYSTEM_ERROR2_NORETURN virtual void _do_throw_exception(const status_code<void> &code) const override // NOLINT
{
assert(code.domain() == *this);
const auto &c = static_cast<const _mycode &>(code); // NOLINT
typename StatusCode::domain_type()._do_throw_exception(c.value()->sc);
static_cast<status_code_domain &&>(typename StatusCode::domain_type())._do_throw_exception(c.value()->sc);
abort(); // suppress buggy GCC warning
}
#endif
Expand Down
1 change: 0 additions & 1 deletion include/status-code/nt_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ using nt_error = status_error<_nt_code_domain>;
class _nt_code_domain : public status_code_domain
{
template <class DomainType> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
friend class _com_code_domain;
using _base = status_code_domain;
static int _nt_code_to_errno(win32::NTSTATUS c)
Expand Down
1 change: 0 additions & 1 deletion include/status-code/posix_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ namespace mixins
class _posix_code_domain : public status_code_domain
{
template <class DomainType> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
using _base = status_code_domain;

static _base::string_ref _make_string_ref(int c) noexcept
Expand Down
1 change: 0 additions & 1 deletion include/status-code/quick_status_code_from_enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ template <class Enum> struct quick_status_code_from_enum_defaults
template <class Enum> class _quick_status_code_from_enum_domain : public status_code_domain
{
template <class DomainType> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
using _base = status_code_domain;
using _src = quick_status_code_from_enum<Enum>;

Expand Down
1 change: 0 additions & 1 deletion include/status-code/std_error_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ namespace mixins
class _std_error_code_domain final : public status_code_domain
{
template <class DomainType> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
using _base = status_code_domain;
using _error_code_type = std::error_code;
using _error_category_type = std::error_category;
Expand Down
1 change: 0 additions & 1 deletion include/status-code/win32_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ namespace mixins
class _win32_code_domain : public status_code_domain
{
template <class DomainType> friend class status_code;
template <class StatusCode, class Allocator> friend class detail::indirecting_domain;
friend class _com_code_domain;
using _base = status_code_domain;
static int _win32_code_to_errno(win32::DWORD c)
Expand Down
Loading