From 99d6d30a150f5989ea7c65addd33c651afccd7c2 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sun, 18 Aug 2024 14:42:12 -0400 Subject: [PATCH] Work around CLang default constructors bug. --- include/bitcoin/system/data/memory.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/bitcoin/system/data/memory.hpp b/include/bitcoin/system/data/memory.hpp index 3ffb4d7fa4..baa45ac7e1 100644 --- a/include/bitcoin/system/data/memory.hpp +++ b/include/bitcoin/system/data/memory.hpp @@ -66,7 +66,12 @@ inline std::shared_ptr to_shared(const Type& value) NOEXCEPT template inline std::shared_ptr to_shared(Args&&... values) NOEXCEPT { +// Type{} required due to CLang bug. +#if defined HAVE_CLANG + return std::make_shared(Type{ std::forward(values)... }); +#else return std::make_shared(std::forward(values)...); +#endif } /// Obtain non constant pointer from shared_ptr to const. @@ -123,7 +128,11 @@ template inline std::unique_ptr to_unique(Args&&... values) NOEXCEPT { // Type{} required due to CLang bug. +#if defined HAVE_CLANG return std::make_unique(Type{ std::forward(values)... }); +#else + return std::make_unique(std::forward(values)...); +#endif } BC_POP_WARNING()