Skip to content

Commit

Permalink
Fix compilation errors with GCC 8
Browse files Browse the repository at this point in the history
  • Loading branch information
raguridan committed Aug 9, 2024
1 parent 3dbd102 commit 0f0ab46
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/multio/message/MetadataValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,37 @@ class MetadataValue : public MetadataValueVariant {
//
// Static cast to base class is done because gcc had a bug with visiting derived classes:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90943 Not required for gcc12
#if defined(__GNUC__) && (__GNUC__ < 9)
template <typename F>
decltype(auto) visit(F&& f) const& noexcept(noexcept(util::visitUnwrapUniquePtr(std::forward<F>(f), *this))) {
decltype(auto) visit(F&& f) const&
#else
template <typename F>
decltype(auto) visit(F&& f) const& noexcept(noexcept(util::visitUnwrapUniquePtr(std::forward<F>(f), *this)))
#endif
{
return util::visitUnwrapUniquePtr(std::forward<F>(f), *this);
}

#if defined(__GNUC__) && (__GNUC__ < 9)
template <typename F>
decltype(auto) visit(F&& f) &
#else
template <typename F>
decltype(auto) visit(F&& f) & noexcept(noexcept(util::visitUnwrapUniquePtr(std::forward<F>(f), *this))) {
decltype(auto) visit(F&& f) & noexcept(noexcept(util::visitUnwrapUniquePtr(std::forward<F>(f), *this)))
#endif
{
return util::visitUnwrapUniquePtr(std::forward<F>(f), *this);
}

#if defined(__GNUC__) && (__GNUC__ < 9)
template <typename F>
decltype(auto) visit(F&& f) &&
#else
template <typename F>
decltype(auto) visit(F&& f) && noexcept(noexcept(util::visitUnwrapUniquePtr(std::forward<F>(f),
std::move(*this)))) {
std::move(*this))))
#endif
{
return util::visitUnwrapUniquePtr(std::forward<F>(f), std::move(*this));
}

Expand Down

0 comments on commit 0f0ab46

Please sign in to comment.