From 4ce0331f1b8ca082810bd57f489b87a6109862a0 Mon Sep 17 00:00:00 2001 From: Koncord Date: Sat, 29 Dec 2018 15:54:08 +0800 Subject: [PATCH] [Server] Fix GCC build --- apps/openmw-mp/Script/LangLua/LangLua.cpp | 8 ++++---- apps/openmw-mp/Script/Types.hpp | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/openmw-mp/Script/LangLua/LangLua.cpp b/apps/openmw-mp/Script/LangLua/LangLua.cpp index 4632c1e56..e853e7aaa 100644 --- a/apps/openmw-mp/Script/LangLua/LangLua.cpp +++ b/apps/openmw-mp/Script/LangLua/LangLua.cpp @@ -110,10 +110,10 @@ template<> struct F_<3> { static constexpr LuaFuctionData F{"CallPublic", LangLu template struct C { - constexpr C(LuaFuctionData *functions_) + constexpr static void Fn(LuaFuctionData *functions_) { functions_[I] = F_::F; - C::C(functions_); + C::Fn(functions_); } }; @@ -121,7 +121,7 @@ struct C template<> struct C<0> { - constexpr C(LuaFuctionData *functions_) + constexpr static void Fn(LuaFuctionData *functions_) { functions_[0] = F_<0>::F; } @@ -132,7 +132,7 @@ LuaFuctionData *functions() { static LuaFuctionData functions_[LastI]; - C::C(functions_); + C::Fn(functions_); static_assert( sizeof(functions_) / sizeof(functions_[0]) == diff --git a/apps/openmw-mp/Script/Types.hpp b/apps/openmw-mp/Script/Types.hpp index 84ac651db..cca05c42b 100644 --- a/apps/openmw-mp/Script/Types.hpp +++ b/apps/openmw-mp/Script/Types.hpp @@ -103,9 +103,13 @@ struct CallbackIdentity struct ScriptFunctionPointer : public ScriptIdentity { void *addr; - +#if (!defined(__clang__) && defined(__GNUC__)) + template + constexpr ScriptFunctionPointer(Function addr) : ScriptIdentity(addr), addr(reinterpret_cast(addr)) {} +#else template constexpr ScriptFunctionPointer(Function addr) : ScriptIdentity(addr), addr(addr) {} +#endif }; struct ScriptFunctionData