fix github issue #15

This commit is contained in:
BlackMATov
2022-10-29 10:32:27 +07:00
parent 24c1457ca9
commit d7a4353ab7
4 changed files with 58 additions and 6 deletions

View File

@@ -44,7 +44,11 @@ namespace meta_hpp::detail
throw_exception_with("an attempt to call a function with incorrect argument types");
}
if constexpr ( as_void ) {
if constexpr ( std::is_void_v<return_type> ) {
function(
args[Is].cast<type_list_at_t<Is, argument_types>>()...);
return uvalue{};
} else if constexpr ( stdex::same_as<Policy, function_policy::discard_return> ) {
std::ignore = function(
args[Is].cast<type_list_at_t<Is, argument_types>>()...);
return uvalue{};

View File

@@ -50,9 +50,12 @@ namespace meta_hpp::detail
throw_exception_with("an attempt to call a method with incorrect argument types");
}
if constexpr ( as_void ) {
if constexpr ( std::is_void_v<return_type> ) {
(inst.cast<qualified_type>().*method)(
args[Is].cast<type_list_at_t<Is, argument_types>>()...);
return uvalue{};
} else if constexpr ( stdex::same_as<Policy, method_policy::discard_return> ) {
std::ignore = (inst.cast<qualified_type>().*method)(
inst.cast<qualified_type>(),
args[Is].cast<type_list_at_t<Is, argument_types>>()...);
return uvalue{};
} else {