aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-01-30 17:10:01 +0100
committerShauren <shauren.trinity@gmail.com>2017-01-30 17:22:01 +0100
commitc2a36c9e89c7cbd638b74334adf1b31acc97af44 (patch)
treebdd0f127416f9170bf102397805e8f91a4084410 /src
parentab413a019d2af4ed65f5a2116651be97762d1b31 (diff)
Fixed clang segmentation fault in nopch mode
(cherry picked from commit 787adc24b2d1a7a3c03ecfed57de27631359ef65)
Diffstat (limited to 'src')
-rw-r--r--src/server/database/Database/QueryCallback.cpp15
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)