From 7f40c4edb63bd010e713fdc3f12aa5bc61d75ee1 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sun, 13 Mar 2016 08:41:29 -0400 Subject: [PATCH] Clang errors because 2 phase lookup is stupid between compilers. --- sol/stack.hpp | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/sol/stack.hpp b/sol/stack.hpp index bdeeb852..9304a29d 100644 --- a/sol/stack.hpp +++ b/sol/stack.hpp @@ -118,28 +118,7 @@ template void set_field(lua_State* L, Key&& key, Value&& value, int tableindex) { field_setter, global>{}.set(L, std::forward(key), std::forward(value), tableindex); } -} // stack -namespace detail { -using special_destruct_func = void(*)(void*); -template -inline void special_destruct(void* memory) { - T** pointerpointer = static_cast(memory); - special_destruct_func* dx = static_cast(static_cast(pointerpointer + 1)); - Real* target = static_cast(static_cast(dx + 1)); - target->~Real(); -} - -template -inline int unique_destruct(lua_State* L) { - void* memory = stack::get(L, 1); - T** pointerpointer = static_cast(memory); - special_destruct_func& dx = *static_cast( static_cast( pointerpointer + 1 ) ); - (dx)(memory); - return 0; -} -} // detail -namespace stack { namespace stack_detail { const bool default_check_arguments = #ifdef SOL_CHECK_ARGUMENTS @@ -219,6 +198,31 @@ struct getter { return lua_touserdata(L, index); } }; +} // stack + +namespace detail { +// This needs to be here, specifically, so that it can use get +using special_destruct_func = void(*)(void*); + +template +inline void special_destruct(void* memory) { + T** pointerpointer = static_cast(memory); + special_destruct_func* dx = static_cast(static_cast(pointerpointer + 1)); + Real* target = static_cast(static_cast(dx + 1)); + target->~Real(); +} + +template +inline int unique_destruct(lua_State* L) { + void* memory = stack::get(L, 1); + T** pointerpointer = static_cast(memory); + special_destruct_func& dx = *static_cast( static_cast( pointerpointer + 1 ) ); + (dx)(memory); + return 0; +} +} // detail + +namespace stack { template struct getter {