From 289ded358c645edc11ce6acadf803cdb96c27113 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Fri, 25 Nov 2016 20:47:15 -0500 Subject: [PATCH] -Wshadow and -Wconversion are kind've dumb --- single/sol/sol.hpp | 103 +++++++++++++++++------------- sol.hpp | 10 +++ sol/call.hpp | 2 +- sol/function_result.hpp | 2 +- sol/function_types_stateful.hpp | 6 +- sol/load_result.hpp | 2 +- sol/optional_implementation.hpp | 14 +++- sol/protected_function_result.hpp | 2 +- sol/proxy.hpp | 2 +- sol/reference.hpp | 38 +++++------ sol/stack_core.hpp | 2 +- sol/state_view.hpp | 10 +-- sol/string_shim.hpp | 4 +- sol/table_core.hpp | 8 ++- sol/types.hpp | 4 +- sol/variadic_args.hpp | 4 +- test_inheritance.cpp | 1 + 17 files changed, 126 insertions(+), 88 deletions(-) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 046b9465..e5a0b767 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2016-11-23 07:55:07.806043 UTC -// This header was generated with sol v2.15.1 (revision ed21ba7) +// Generated 2016-11-26 01:46:59.897910 UTC +// This header was generated with sol v2.15.2 (revision 49a0f71) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -1904,19 +1904,24 @@ namespace sol { # define OPTIONAL_CONSTEXPR_INIT_LIST # endif -# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L) +# if defined(TR2_OPTIONAL_MSVC_2015_AND_HIGHER___) || (defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L)) # define OPTIONAL_HAS_MOVE_ACCESSORS 1 # else # define OPTIONAL_HAS_MOVE_ACCESSORS 0 # endif # // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr -# if (defined __cplusplus) && (__cplusplus == 201103L) +# if defined(TR2_OPTIONAL_MSVC_2015_AND_HIGHER___) || ((defined __cplusplus) && (__cplusplus == 201103L)) # define OPTIONAL_MUTABLE_CONSTEXPR # else # define OPTIONAL_MUTABLE_CONSTEXPR constexpr # endif +# if defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ +#pragma warning( push ) +#pragma warning( disable : 4814 ) +#endif + namespace sol { // BEGIN workaround for missing is_trivially_destructible @@ -2885,6 +2890,10 @@ namespace std }; } +# if defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ +#pragma warning( pop ) +#endif + # undef TR2_OPTIONAL_REQUIRES # undef TR2_OPTIONAL_ASSERTED_EXPRESSION @@ -2917,8 +2926,8 @@ namespace sol { const char* p; string_shim(const std::string& r) : string_shim(r.data(), r.size()) {} - string_shim(const char* p) : string_shim(p, std::char_traits::length(p)) {} - string_shim(const char* p, std::size_t s) : s(s), p(p) {} + string_shim(const char* ptr) : string_shim(ptr, std::char_traits::length(ptr)) {} + string_shim(const char* ptr, std::size_t sz) : s(sz), p(ptr) {} static int compare(const char* lhs_p, std::size_t lhs_sz, const char* rhs_p, std::size_t rhs_sz) { int result = std::char_traits::compare(lhs_p, rhs_p, lhs_sz < rhs_sz ? lhs_sz : rhs_sz); @@ -3195,14 +3204,14 @@ namespace sol { struct closure { lua_CFunction c_function; std::tuple upvalues; - closure(lua_CFunction f, Upvalues... upvalues) : c_function(f), upvalues(std::forward(upvalues)...) {} + closure(lua_CFunction f, Upvalues... targetupvalues) : c_function(f), upvalues(std::forward(targetupvalues)...) {} }; template <> struct closure<> { lua_CFunction c_function; int upvalues; - closure(lua_CFunction f, int upvalues = 0) : c_function(f), upvalues(upvalues) {} + closure(lua_CFunction f, int upvalue_count = 0) : c_function(f), upvalues(upvalue_count) {} }; typedef closure<> c_closure; @@ -3787,7 +3796,7 @@ namespace sol { struct push_popper_n { lua_State* L; int t; - push_popper_n(lua_State* L, int x) : L(L), t(x) { } + push_popper_n(lua_State* luastate, int x) : L(luastate), t(x) { } ~push_popper_n() { lua_pop(L, t); } }; template <> @@ -3821,20 +3830,20 @@ namespace sol { class reference { private: - lua_State* L = nullptr; // non-owning + lua_State* luastate = nullptr; // non-owning int ref = LUA_NOREF; int copy() const noexcept { if (ref == LUA_NOREF) return LUA_NOREF; push(); - return luaL_ref(L, LUA_REGISTRYINDEX); + return luaL_ref(lua_state(), LUA_REGISTRYINDEX); } protected: - reference(lua_State* L, detail::global_tag) noexcept : L(L) { - lua_pushglobaltable(L); - ref = luaL_ref(L, LUA_REGISTRYINDEX); + reference(lua_State* L, detail::global_tag) noexcept : luastate(L) { + lua_pushglobaltable(lua_state()); + ref = luaL_ref(lua_state(), LUA_REGISTRYINDEX); } int stack_index() const noexcept { @@ -3846,46 +3855,46 @@ namespace sol { reference(nil_t) noexcept : reference() {} reference(const stack_reference& r) noexcept : reference(r.lua_state(), r.stack_index()) {} reference(stack_reference&& r) noexcept : reference(r.lua_state(), r.stack_index()) {} - reference(lua_State* L, int index = -1) noexcept : L(L) { - lua_pushvalue(L, index); - ref = luaL_ref(L, LUA_REGISTRYINDEX); + reference(lua_State* L, int index = -1) noexcept : luastate(L) { + lua_pushvalue(lua_state(), index); + ref = luaL_ref(lua_state(), LUA_REGISTRYINDEX); } virtual ~reference() noexcept { - luaL_unref(L, LUA_REGISTRYINDEX, ref); + luaL_unref(lua_state(), LUA_REGISTRYINDEX, ref); } reference(reference&& o) noexcept { - L = o.L; + luastate = o.luastate; ref = o.ref; - o.L = nullptr; + o.luastate = nullptr; o.ref = LUA_NOREF; } reference& operator=(reference&& o) noexcept { - L = o.L; + luastate = o.luastate; ref = o.ref; - o.L = nullptr; + o.luastate = nullptr; o.ref = LUA_NOREF; return *this; } reference(const reference& o) noexcept { - L = o.L; + luastate = o.luastate; ref = o.copy(); } reference& operator=(const reference& o) noexcept { - L = o.L; + luastate = o.luastate; ref = o.copy(); return *this; } int push() const noexcept { - lua_rawgeti(L, LUA_REGISTRYINDEX, ref); + lua_rawgeti(lua_state(), LUA_REGISTRYINDEX, ref); return 1; } @@ -3907,12 +3916,12 @@ namespace sol { type get_type() const noexcept { auto pp = stack::push_pop(*this); - int result = lua_type(L, -1); + int result = lua_type(lua_state(), -1); return static_cast(result); } lua_State* lua_state() const noexcept { - return L; + return luastate; } }; @@ -4335,7 +4344,7 @@ namespace sol { template inline auto tagged_get(types, lua_State* L, int index, record& tracking) -> decltype(stack_detail::unchecked_get(L, index, tracking)) { auto op = check_get(L, index, type_panic, tracking); - return *op; + return *std::move(op); } #else template @@ -7077,7 +7086,7 @@ namespace sol { public: function_result() = default; - function_result(lua_State* L, int index = -1, int returncount = 0) : L(L), index(index), returncount(returncount) { + function_result(lua_State* Ls, int idx = -1, int retnum = 0) : L(Ls), index(idx), returncount(retnum) { } function_result(const function_result&) = default; @@ -7493,7 +7502,7 @@ namespace sol { struct constructor_match { T* obj; - constructor_match(T* obj) : obj(obj) {} + constructor_match(T* o) : obj(o) {} template int operator()(types, index_value, types r, types a, lua_State* L, int, int start) const { @@ -8319,7 +8328,7 @@ namespace sol { } int operator()(lua_State* L) { - auto f = [&](lua_State* L) -> int { return this->call(L); }; + auto f = [&](lua_State*) -> int { return this->call(L); }; return detail::trampoline(L, f); } }; @@ -8340,7 +8349,7 @@ namespace sol { } int operator()(lua_State* L) { - auto f = [&](lua_State* L) -> int { return this->call(L); }; + auto f = [&](lua_State*) -> int { return this->call(L); }; return detail::trampoline(L, f); } }; @@ -8370,7 +8379,7 @@ namespace sol { } int operator()(lua_State* L) { - auto f = [&](lua_State* L) -> int { return this->call(L); }; + auto f = [&](lua_State*) -> int { return this->call(L); }; return detail::trampoline(L, f); } }; @@ -9035,7 +9044,7 @@ namespace sol { public: protected_function_result() = default; - protected_function_result(lua_State* L, int index = -1, int returncount = 0, int popcount = 0, call_status err = call_status::ok) noexcept : L(L), index(index), returncount(returncount), popcount(popcount), err(err) { + protected_function_result(lua_State* Ls, int idx = -1, int retnum = 0, int popped = 0, call_status pferr = call_status::ok) noexcept : L(Ls), index(idx), returncount(retnum), popcount(popped), err(pferr) { } protected_function_result(const protected_function_result&) = default; @@ -9368,7 +9377,7 @@ namespace sol { stack_proxy sp; va_iterator() : L(nullptr), index((std::numeric_limits::max)()), stacktop((std::numeric_limits::max)()) {} - va_iterator(lua_State* L, int index, int stacktop) : L(L), index(index), stacktop(stacktop), sp(L, index) {} + va_iterator(lua_State* luastate, int idx, int topidx) : L(luastate), index(idx), stacktop(topidx), sp(luastate, idx) {} reference operator*() { return stack_proxy(L, index); @@ -9479,7 +9488,7 @@ namespace sol { typedef std::reverse_iterator const_reverse_iterator; variadic_args() = default; - variadic_args(lua_State* L, int index = -1) : L(L), index(lua_absindex(L, index)), stacktop(lua_gettop(L)) {} + variadic_args(lua_State* luastate, int stackindex = -1) : L(luastate), index(lua_absindex(luastate, stackindex)), stacktop(lua_gettop(luastate)) {} variadic_args(const variadic_args&) = default; variadic_args& operator=(const variadic_args&) = default; variadic_args(variadic_args&& o) : L(o.L), index(o.index), stacktop(o.stacktop) { @@ -9705,7 +9714,7 @@ namespace sol { key_type key; template - proxy(Table table, T&& key) : tbl(table), key(std::forward(key)) {} + proxy(Table table, T&& k) : tbl(table), key(std::forward(k)) {} template proxy& set(T&& item) { @@ -11618,8 +11627,8 @@ namespace sol { namespace sol { namespace detail { template - struct clean { lua_State* L; clean(lua_State* L) : L(L) {} ~clean() { lua_pop(L, static_cast(n)); } }; - struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* L, int& n) : L(L), n(n) {} ~ref_clean() { lua_pop(L, static_cast(n)); } }; + struct clean { lua_State* L; clean(lua_State* luastate) : L(luastate) {} ~clean() { lua_pop(L, static_cast(n)); } }; + struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* luastate, int& n) : L(luastate), n(n) {} ~ref_clean() { lua_pop(L, static_cast(n)); } }; inline int fail_on_newindex(lua_State* L) { return luaL_error(L, "sol: cannot modify the elements of an enumeration table"); } @@ -12044,6 +12053,10 @@ namespace sol { static const int narr = static_cast(meta::count_2_for_pack::value); return create(std::forward(name), narr, sizeof...(Args) / 2 - narr, std::forward(args)...); } + + ~basic_table_core() { + + } }; } // sol @@ -12102,7 +12115,7 @@ namespace sol { public: load_result() = default; - load_result(lua_State* L, int index = -1, int returncount = 0, int popcount = 0, load_status err = load_status::ok) noexcept : L(L), index(index), returncount(returncount), popcount(popcount), err(err) { + load_result(lua_State* Ls, int stackindex = -1, int retnum = 0, int popnum = 0, load_status lerr = load_status::ok) noexcept : L(Ls), index(stackindex), returncount(retnum), popcount(popnum), err(lerr) { } load_result(const load_result&) = default; @@ -12249,14 +12262,14 @@ namespace sol { typedef global_table::iterator iterator; typedef global_table::const_iterator const_iterator; - state_view(lua_State* L) : - L(L), - reg(L, LUA_REGISTRYINDEX), - global(L, detail::global_) { + state_view(lua_State* Ls) : + L(Ls), + reg(Ls, LUA_REGISTRYINDEX), + global(Ls, detail::global_) { } - state_view(this_state L) : state_view(L.L){ + state_view(this_state Ls) : state_view(Ls.L){ } diff --git a/sol.hpp b/sol.hpp index fcde72bb..b4a737c0 100644 --- a/sol.hpp +++ b/sol.hpp @@ -33,6 +33,12 @@ #endif #endif // Unreal Engine 4 Bullshit +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wconversion" +#endif // g++ + #include "sol/state.hpp" #include "sol/object.hpp" #include "sol/function.hpp" @@ -41,6 +47,10 @@ #include "sol/coroutine.hpp" #include "sol/variadic_args.hpp" +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif // g++ + #ifdef SOL_INSIDE_UNREAL #ifdef SOL_INSIDE_UNREAL_REMOVED_CHECK #define check(expr) { if(UNLIKELY(!(expr))) { FDebug::LogAssertFailedMessage( #expr, __FILE__, __LINE__ ); _DebugBreakAndPromptForRemote(); FDebug::AssertFailed( #expr, __FILE__, __LINE__ ); CA_ASSUME(false); } }} diff --git a/sol/call.hpp b/sol/call.hpp index abd9dd49..5bbd19c3 100644 --- a/sol/call.hpp +++ b/sol/call.hpp @@ -52,7 +52,7 @@ namespace sol { struct constructor_match { T* obj; - constructor_match(T* obj) : obj(obj) {} + constructor_match(T* o) : obj(o) {} template int operator()(types, index_value, types r, types a, lua_State* L, int, int start) const { diff --git a/sol/function_result.hpp b/sol/function_result.hpp index e7c0e6c1..4e4da128 100644 --- a/sol/function_result.hpp +++ b/sol/function_result.hpp @@ -37,7 +37,7 @@ namespace sol { public: function_result() = default; - function_result(lua_State* L, int index = -1, int returncount = 0) : L(L), index(index), returncount(returncount) { + function_result(lua_State* Ls, int idx = -1, int retnum = 0) : L(Ls), index(idx), returncount(retnum) { } function_result(const function_result&) = default; diff --git a/sol/function_types_stateful.hpp b/sol/function_types_stateful.hpp index 5ec2bc25..aa79dadb 100644 --- a/sol/function_types_stateful.hpp +++ b/sol/function_types_stateful.hpp @@ -39,7 +39,7 @@ namespace sol { } int operator()(lua_State* L) { - auto f = [&](lua_State* L) -> int { return this->call(L); }; + auto f = [&](lua_State*) -> int { return this->call(L); }; return detail::trampoline(L, f); } }; @@ -60,7 +60,7 @@ namespace sol { } int operator()(lua_State* L) { - auto f = [&](lua_State* L) -> int { return this->call(L); }; + auto f = [&](lua_State*) -> int { return this->call(L); }; return detail::trampoline(L, f); } }; @@ -90,7 +90,7 @@ namespace sol { } int operator()(lua_State* L) { - auto f = [&](lua_State* L) -> int { return this->call(L); }; + auto f = [&](lua_State*) -> int { return this->call(L); }; return detail::trampoline(L, f); } }; diff --git a/sol/load_result.hpp b/sol/load_result.hpp index 0f465a2b..443b3d76 100644 --- a/sol/load_result.hpp +++ b/sol/load_result.hpp @@ -72,7 +72,7 @@ namespace sol { public: load_result() = default; - load_result(lua_State* L, int index = -1, int returncount = 0, int popcount = 0, load_status err = load_status::ok) noexcept : L(L), index(index), returncount(returncount), popcount(popcount), err(err) { + load_result(lua_State* Ls, int stackindex = -1, int retnum = 0, int popnum = 0, load_status lerr = load_status::ok) noexcept : L(Ls), index(stackindex), returncount(retnum), popcount(popnum), err(lerr) { } load_result(const load_result&) = default; diff --git a/sol/optional_implementation.hpp b/sol/optional_implementation.hpp index d7c5a1ec..ad281785 100644 --- a/sol/optional_implementation.hpp +++ b/sol/optional_implementation.hpp @@ -110,19 +110,24 @@ # define OPTIONAL_CONSTEXPR_INIT_LIST # endif -# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L) +# if defined(TR2_OPTIONAL_MSVC_2015_AND_HIGHER___) || (defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L)) # define OPTIONAL_HAS_MOVE_ACCESSORS 1 # else # define OPTIONAL_HAS_MOVE_ACCESSORS 0 # endif # // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr -# if (defined __cplusplus) && (__cplusplus == 201103L) +# if defined(TR2_OPTIONAL_MSVC_2015_AND_HIGHER___) || ((defined __cplusplus) && (__cplusplus == 201103L)) # define OPTIONAL_MUTABLE_CONSTEXPR # else # define OPTIONAL_MUTABLE_CONSTEXPR constexpr # endif +# if defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ +#pragma warning( push ) +#pragma warning( disable : 4814 ) +#endif + namespace sol { // BEGIN workaround for missing is_trivially_destructible @@ -1121,6 +1126,11 @@ namespace std }; } +# if defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ +#pragma warning( pop ) +#endif + + # undef TR2_OPTIONAL_REQUIRES # undef TR2_OPTIONAL_ASSERTED_EXPRESSION diff --git a/sol/protected_function_result.hpp b/sol/protected_function_result.hpp index bac0fc0f..9fce5753 100644 --- a/sol/protected_function_result.hpp +++ b/sol/protected_function_result.hpp @@ -73,7 +73,7 @@ namespace sol { public: protected_function_result() = default; - protected_function_result(lua_State* L, int index = -1, int returncount = 0, int popcount = 0, call_status err = call_status::ok) noexcept : L(L), index(index), returncount(returncount), popcount(popcount), err(err) { + protected_function_result(lua_State* Ls, int idx = -1, int retnum = 0, int popped = 0, call_status pferr = call_status::ok) noexcept : L(Ls), index(idx), returncount(retnum), popcount(popped), err(pferr) { } protected_function_result(const protected_function_result&) = default; diff --git a/sol/proxy.hpp b/sol/proxy.hpp index 28da48d9..5d99e293 100644 --- a/sol/proxy.hpp +++ b/sol/proxy.hpp @@ -49,7 +49,7 @@ namespace sol { key_type key; template - proxy(Table table, T&& key) : tbl(table), key(std::forward(key)) {} + proxy(Table table, T&& k) : tbl(table), key(std::forward(k)) {} template proxy& set(T&& item) { diff --git a/sol/reference.hpp b/sol/reference.hpp index 9409c2cf..c34d26ce 100644 --- a/sol/reference.hpp +++ b/sol/reference.hpp @@ -31,7 +31,7 @@ namespace sol { struct push_popper_n { lua_State* L; int t; - push_popper_n(lua_State* L, int x) : L(L), t(x) { } + push_popper_n(lua_State* luastate, int x) : L(luastate), t(x) { } ~push_popper_n() { lua_pop(L, t); } }; template <> @@ -65,20 +65,20 @@ namespace sol { class reference { private: - lua_State* L = nullptr; // non-owning + lua_State* luastate = nullptr; // non-owning int ref = LUA_NOREF; int copy() const noexcept { if (ref == LUA_NOREF) return LUA_NOREF; push(); - return luaL_ref(L, LUA_REGISTRYINDEX); + return luaL_ref(lua_state(), LUA_REGISTRYINDEX); } protected: - reference(lua_State* L, detail::global_tag) noexcept : L(L) { - lua_pushglobaltable(L); - ref = luaL_ref(L, LUA_REGISTRYINDEX); + reference(lua_State* L, detail::global_tag) noexcept : luastate(L) { + lua_pushglobaltable(lua_state()); + ref = luaL_ref(lua_state(), LUA_REGISTRYINDEX); } int stack_index() const noexcept { @@ -90,46 +90,46 @@ namespace sol { reference(nil_t) noexcept : reference() {} reference(const stack_reference& r) noexcept : reference(r.lua_state(), r.stack_index()) {} reference(stack_reference&& r) noexcept : reference(r.lua_state(), r.stack_index()) {} - reference(lua_State* L, int index = -1) noexcept : L(L) { - lua_pushvalue(L, index); - ref = luaL_ref(L, LUA_REGISTRYINDEX); + reference(lua_State* L, int index = -1) noexcept : luastate(L) { + lua_pushvalue(lua_state(), index); + ref = luaL_ref(lua_state(), LUA_REGISTRYINDEX); } virtual ~reference() noexcept { - luaL_unref(L, LUA_REGISTRYINDEX, ref); + luaL_unref(lua_state(), LUA_REGISTRYINDEX, ref); } reference(reference&& o) noexcept { - L = o.L; + luastate = o.luastate; ref = o.ref; - o.L = nullptr; + o.luastate = nullptr; o.ref = LUA_NOREF; } reference& operator=(reference&& o) noexcept { - L = o.L; + luastate = o.luastate; ref = o.ref; - o.L = nullptr; + o.luastate = nullptr; o.ref = LUA_NOREF; return *this; } reference(const reference& o) noexcept { - L = o.L; + luastate = o.luastate; ref = o.copy(); } reference& operator=(const reference& o) noexcept { - L = o.L; + luastate = o.luastate; ref = o.copy(); return *this; } int push() const noexcept { - lua_rawgeti(L, LUA_REGISTRYINDEX, ref); + lua_rawgeti(lua_state(), LUA_REGISTRYINDEX, ref); return 1; } @@ -151,12 +151,12 @@ namespace sol { type get_type() const noexcept { auto pp = stack::push_pop(*this); - int result = lua_type(L, -1); + int result = lua_type(lua_state(), -1); return static_cast(result); } lua_State* lua_state() const noexcept { - return L; + return luastate; } }; diff --git a/sol/stack_core.hpp b/sol/stack_core.hpp index 13fad796..2675e02e 100644 --- a/sol/stack_core.hpp +++ b/sol/stack_core.hpp @@ -258,7 +258,7 @@ namespace sol { template inline auto tagged_get(types, lua_State* L, int index, record& tracking) -> decltype(stack_detail::unchecked_get(L, index, tracking)) { auto op = check_get(L, index, type_panic, tracking); - return *op; + return *std::move(op); } #else template diff --git a/sol/state_view.hpp b/sol/state_view.hpp index 4d929590..36f3240f 100644 --- a/sol/state_view.hpp +++ b/sol/state_view.hpp @@ -108,14 +108,14 @@ namespace sol { typedef global_table::iterator iterator; typedef global_table::const_iterator const_iterator; - state_view(lua_State* L) : - L(L), - reg(L, LUA_REGISTRYINDEX), - global(L, detail::global_) { + state_view(lua_State* Ls) : + L(Ls), + reg(Ls, LUA_REGISTRYINDEX), + global(Ls, detail::global_) { } - state_view(this_state L) : state_view(L.L){ + state_view(this_state Ls) : state_view(Ls.L){ } diff --git a/sol/string_shim.hpp b/sol/string_shim.hpp index b1e685bd..79ad15de 100644 --- a/sol/string_shim.hpp +++ b/sol/string_shim.hpp @@ -10,8 +10,8 @@ namespace sol { const char* p; string_shim(const std::string& r) : string_shim(r.data(), r.size()) {} - string_shim(const char* p) : string_shim(p, std::char_traits::length(p)) {} - string_shim(const char* p, std::size_t s) : s(s), p(p) {} + string_shim(const char* ptr) : string_shim(ptr, std::char_traits::length(ptr)) {} + string_shim(const char* ptr, std::size_t sz) : s(sz), p(ptr) {} static int compare(const char* lhs_p, std::size_t lhs_sz, const char* rhs_p, std::size_t rhs_sz) { int result = std::char_traits::compare(lhs_p, rhs_p, lhs_sz < rhs_sz ? lhs_sz : rhs_sz); diff --git a/sol/table_core.hpp b/sol/table_core.hpp index 107cd197..2c3270df 100644 --- a/sol/table_core.hpp +++ b/sol/table_core.hpp @@ -31,8 +31,8 @@ namespace sol { namespace detail { template - struct clean { lua_State* L; clean(lua_State* L) : L(L) {} ~clean() { lua_pop(L, static_cast(n)); } }; - struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* L, int& n) : L(L), n(n) {} ~ref_clean() { lua_pop(L, static_cast(n)); } }; + struct clean { lua_State* L; clean(lua_State* luastate) : L(luastate) {} ~clean() { lua_pop(L, static_cast(n)); } }; + struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* luastate, int& n) : L(luastate), n(n) {} ~ref_clean() { lua_pop(L, static_cast(n)); } }; inline int fail_on_newindex(lua_State* L) { return luaL_error(L, "sol: cannot modify the elements of an enumeration table"); } @@ -457,6 +457,10 @@ namespace sol { static const int narr = static_cast(meta::count_2_for_pack::value); return create(std::forward(name), narr, sizeof...(Args) / 2 - narr, std::forward(args)...); } + + ~basic_table_core() { + + } }; } // sol diff --git a/sol/types.hpp b/sol/types.hpp index fda0d761..4fbdea8f 100644 --- a/sol/types.hpp +++ b/sol/types.hpp @@ -252,14 +252,14 @@ namespace sol { struct closure { lua_CFunction c_function; std::tuple upvalues; - closure(lua_CFunction f, Upvalues... upvalues) : c_function(f), upvalues(std::forward(upvalues)...) {} + closure(lua_CFunction f, Upvalues... targetupvalues) : c_function(f), upvalues(std::forward(targetupvalues)...) {} }; template <> struct closure<> { lua_CFunction c_function; int upvalues; - closure(lua_CFunction f, int upvalues = 0) : c_function(f), upvalues(upvalues) {} + closure(lua_CFunction f, int upvalue_count = 0) : c_function(f), upvalues(upvalue_count) {} }; typedef closure<> c_closure; diff --git a/sol/variadic_args.hpp b/sol/variadic_args.hpp index 36fa3cda..cd1161c6 100644 --- a/sol/variadic_args.hpp +++ b/sol/variadic_args.hpp @@ -42,7 +42,7 @@ namespace sol { stack_proxy sp; va_iterator() : L(nullptr), index((std::numeric_limits::max)()), stacktop((std::numeric_limits::max)()) {} - va_iterator(lua_State* L, int index, int stacktop) : L(L), index(index), stacktop(stacktop), sp(L, index) {} + va_iterator(lua_State* luastate, int idx, int topidx) : L(luastate), index(idx), stacktop(topidx), sp(luastate, idx) {} reference operator*() { return stack_proxy(L, index); @@ -153,7 +153,7 @@ namespace sol { typedef std::reverse_iterator const_reverse_iterator; variadic_args() = default; - variadic_args(lua_State* L, int index = -1) : L(L), index(lua_absindex(L, index)), stacktop(lua_gettop(L)) {} + variadic_args(lua_State* luastate, int stackindex = -1) : L(luastate), index(lua_absindex(luastate, stackindex)), stacktop(lua_gettop(luastate)) {} variadic_args(const variadic_args&) = default; variadic_args& operator=(const variadic_args&) = default; variadic_args(variadic_args&& o) : L(o.L), index(o.index), stacktop(o.stacktop) { diff --git a/test_inheritance.cpp b/test_inheritance.cpp index 5afb363b..ccd46b7d 100644 --- a/test_inheritance.cpp +++ b/test_inheritance.cpp @@ -144,6 +144,7 @@ tc3 = TestClass03(tc1) TestClass01& tc1 = lua["tc1"]; TestClass02& tc2 = lua["tc2"]; TestClass03& tc3 = lua["tc3"]; + REQUIRE(tc0.Thing() == 123); REQUIRE(tc1.a == 1); REQUIRE(tc2.a == 1); REQUIRE(tc2.b == 123);