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

Work around CLang default constructors bug. #1521

Merged
merged 1 commit into from
Aug 18, 2024
Merged
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
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
Loading