mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
tfw no common_type for ternary...
This commit is contained in:
parent
db5494ee37
commit
f8ee7abe52
|
@ -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 2018-05-12 15:15:35.133726 UTC
|
||||
// This header was generated with sol v2.20.0 (revision 9106597)
|
||||
// Generated 2018-05-13 00:04:17.889207 UTC
|
||||
// This header was generated with sol v2.20.0 (revision db5494e)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||
|
@ -18339,8 +18339,8 @@ namespace sol {
|
|||
template <bool is_index, bool toplevel = false>
|
||||
static int core_indexing_call(lua_State* L) {
|
||||
usertype_metatable& f = toplevel
|
||||
? stack::get<light<usertype_metatable>>(L, upvalue_index(usertype_detail::metatable_index))
|
||||
: stack::pop<user<usertype_metatable>>(L);
|
||||
? static_cast<usertype_metatable&>(stack::get<light<usertype_metatable>>(L, upvalue_index(usertype_detail::metatable_index)))
|
||||
: static_cast<usertype_metatable&>(stack::pop<user<usertype_metatable>>(L));
|
||||
static const int keyidx = -2 + static_cast<int>(is_index);
|
||||
if (toplevel && stack::get<type>(L, keyidx) != type::string) {
|
||||
return is_index ? f.indexfunc(L) : f.newindexfunc(L);
|
||||
|
|
|
@ -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 2018-05-12 15:15:35.377146 UTC
|
||||
// This header was generated with sol v2.20.0 (revision 9106597)
|
||||
// Generated 2018-05-13 00:04:18.118574 UTC
|
||||
// This header was generated with sol v2.20.0 (revision db5494e)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||
|
|
|
@ -567,8 +567,8 @@ namespace sol {
|
|||
template <bool is_index, bool toplevel = false>
|
||||
static int core_indexing_call(lua_State* L) {
|
||||
usertype_metatable& f = toplevel
|
||||
? stack::get<light<usertype_metatable>>(L, upvalue_index(usertype_detail::metatable_index))
|
||||
: stack::pop<user<usertype_metatable>>(L);
|
||||
? static_cast<usertype_metatable&>(stack::get<light<usertype_metatable>>(L, upvalue_index(usertype_detail::metatable_index)))
|
||||
: static_cast<usertype_metatable&>(stack::pop<user<usertype_metatable>>(L));
|
||||
static const int keyidx = -2 + static_cast<int>(is_index);
|
||||
if (toplevel && stack::get<type>(L, keyidx) != type::string) {
|
||||
return is_index ? f.indexfunc(L) : f.newindexfunc(L);
|
||||
|
|
|
@ -302,6 +302,12 @@ struct matrix_xi {
|
|||
return m;
|
||||
}
|
||||
};
|
||||
template <typename SelfType>
|
||||
struct alignas(16) weird_aligned_wrapper {
|
||||
void operator()(SelfType& self, sol::object param) const {
|
||||
}
|
||||
std::function<void(SelfType&, float)> lambda;
|
||||
};
|
||||
|
||||
TEST_CASE("usertype/usertype", "Show that we can create classes from usertype and use them") {
|
||||
sol::state lua;
|
||||
|
@ -1787,6 +1793,24 @@ TEST_CASE("usertype/runtime-replacement", "ensure that functions can be properly
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/alignment", "ensure that alignment does not trigger weird aliasing issues") {
|
||||
struct aligned_base {};
|
||||
struct aligned_derived : aligned_base {};
|
||||
|
||||
sol::state lua;
|
||||
|
||||
lua.new_usertype<aligned_base>("Base",
|
||||
"x", sol::writeonly_property(weird_aligned_wrapper<aligned_base>{}));
|
||||
lua.new_usertype<aligned_derived>("Derived",
|
||||
sol::base_classes, sol::bases<aligned_base>());
|
||||
|
||||
aligned_derived d;
|
||||
lua["d"] = d;
|
||||
|
||||
auto result = lua.safe_script("d.x = 5");
|
||||
REQUIRE(result.valid());
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/meta-key-retrievals", "allow for special meta keys (__index, __newindex) to trigger methods even if overwritten directly") {
|
||||
SECTION("dynamically") {
|
||||
static int writes = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user