Skip to content

Commit

Permalink
Work around CLang default constructors bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Aug 18, 2024
1 parent 831c7dc commit 99d6d30
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/bitcoin/system/data/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ inline std::shared_ptr<const Type> to_shared(const Type& value) NOEXCEPT
template <typename Type, typename ...Args>
inline std::shared_ptr<const Type> to_shared(Args&&... values) NOEXCEPT
{
// Type{} required due to CLang bug.
#if defined HAVE_CLANG
return std::make_shared<const Type>(Type{ std::forward<Args>(values)... });
#else
return std::make_shared<const Type>(std::forward<Args>(values)...);
#endif
}

/// Obtain non constant pointer from shared_ptr to const.
Expand Down Expand Up @@ -123,7 +128,11 @@ template <typename Type, typename ...Args>
inline std::unique_ptr<const Type> to_unique(Args&&... values) NOEXCEPT
{
// Type{} required due to CLang bug.
#if defined HAVE_CLANG
return std::make_unique<const Type>(Type{ std::forward<Args>(values)... });
#else
return std::make_unique<const Type>(std::forward<Args>(values)...);
#endif
}

BC_POP_WARNING()
Expand Down

0 comments on commit 99d6d30

Please sign in to comment.