diff options
author | Shauren <shauren.trinity@gmail.com> | 2017-01-30 17:10:01 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2017-01-30 17:10:01 +0100 |
commit | 787adc24b2d1a7a3c03ecfed57de27631359ef65 (patch) | |
tree | 57be63538f0f6c5eea5f6802e1f0ce6370122eca /src/server/database/Database/QueryCallback.cpp | |
parent | 7a9515b3881dca9eb46df634a83f968c75b430c8 (diff) |
Fixed clang segmentation fault in nopch mode
Diffstat (limited to 'src/server/database/Database/QueryCallback.cpp')
-rw-r--r-- | src/server/database/Database/QueryCallback.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
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<typename T> -inline void Construct(T& t) +template<typename T, typename... Args> +inline void Construct(T& t, Args&&... args) { - new (&t) T(); + new (&t) T(std::forward<Args>(args)...); } template<typename T> @@ -103,12 +103,17 @@ private: bool _isPrepared; }; -QueryCallback::QueryCallback(std::future<QueryResult>&& 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<QueryResult>&& result) { + _isPrepared = false; + Construct(_string, std::move(result)); } -QueryCallback::QueryCallback(std::future<PreparedQueryResult>&& result) : _prepared(std::move(result)), _isPrepared(true) +QueryCallback::QueryCallback(std::future<PreparedQueryResult>&& result) { + _isPrepared = true; + Construct(_prepared, std::move(result)); } QueryCallback::QueryCallback(QueryCallback&& right) |