diff --git a/test_functions.cpp b/test_functions.cpp index 5f06777e..d1c85bfd 100644 --- a/test_functions.cpp +++ b/test_functions.cpp @@ -99,6 +99,9 @@ struct fer { } }; +inline void noexcept_function() noexcept {} +struct type_with_noexcept_method{ void noexcept_method() noexcept {} }; + TEST_CASE("functions/tuple-returns", "Make sure tuple returns are ordered properly") { sol::state lua; lua.script("function f() return '3', 4 end"); @@ -1222,3 +1225,10 @@ TEST_CASE("functions/unique-overloading", "make sure overloading can work with p }()); }; } + +TEST_CASE("functions/noexcept", "allow noexcept free - and member functions in Lua") { + sol::state lua; + + lua.set_function("noexcept_function", &noexcept_function); + lua.set_function("noexcept_member_function", &type_with_noexcept_method::noexcept_method); +} diff --git a/test_usertypes.cpp b/test_usertypes.cpp index 6a2b90b6..6bab97a2 100644 --- a/test_usertypes.cpp +++ b/test_usertypes.cpp @@ -265,6 +265,9 @@ struct matrix_xi { } }; +inline void noexcept_function() noexcept {} +struct type_with_noexcept_method{ void noexcept_method() noexcept {} }; + TEST_CASE("usertype/usertype", "Show that we can create classes from usertype and use them") { sol::state lua; @@ -1809,3 +1812,8 @@ TEST_CASE("usertype/meta-key-retrievals", "allow for special meta keys (__index, REQUIRE(keys[3] == "__call"); } } + +TEST_CASE("usertype/noexcept-methods", "make sure noexcept functinos and methods can be bound to usertypes without issues") { + sol::state lua; + lua.new_usertype("tmp", "nf", &noexcept_function, "nm", &type_with_noexcept_method::noexcept_method); +}