diff --git a/src/server/database/Database/QueryCallback.cpp b/src/server/database/Database/QueryCallback.cpp index 96361e54ede..2d89e08a956 100644 --- a/src/server/database/Database/QueryCallback.cpp +++ b/src/server/database/Database/QueryCallback.cpp @@ -17,10 +17,10 @@ #include "QueryCallback.h" -template -inline void Construct(T& t) +template +inline void Construct(T& t, Args&&... args) { - new (&t) T(); + new (&t) T(std::forward(args)...); } template @@ -103,12 +103,17 @@ private: bool _isPrepared; }; -QueryCallback::QueryCallback(std::future&& result) : _string(std::move(result)), _isPrepared(false) +// Not using initialization lists to work around segmentation faults when compiling with clang without precompiled headers +QueryCallback::QueryCallback(std::future&& result) { + _isPrepared = false; + Construct(_string, std::move(result)); } -QueryCallback::QueryCallback(std::future&& result) : _prepared(std::move(result)), _isPrepared(true) +QueryCallback::QueryCallback(std::future&& result) { + _isPrepared = true; + Construct(_prepared, std::move(result)); } QueryCallback::QueryCallback(QueryCallback&& right)