return types for meta_func are no longer ambiguous (close #274)
This commit is contained in:
@@ -2269,6 +2269,7 @@ invoke(const meta_handle &, meta_any *args, std::index_sequence<Indexes...>) {
|
||||
{
|
||||
if constexpr(std::is_void_v<typename helper_type::return_type>) {
|
||||
std::invoke(Func, (args+Indexes)->cast<typename helper_type::template arg_type<Indexes>>()...);
|
||||
any.emplace<void>();
|
||||
} else {
|
||||
any = meta_any{std::invoke(Func, (args+Indexes)->cast<typename helper_type::template arg_type<Indexes>>()...)};
|
||||
}
|
||||
@@ -2291,6 +2292,7 @@ invoke(meta_handle &handle, meta_any *args, std::index_sequence<Indexes...>) {
|
||||
{
|
||||
if constexpr(std::is_void_v<typename helper_type::return_type>) {
|
||||
std::invoke(Member, clazz, (args+Indexes)->cast<typename helper_type::template arg_type<Indexes>>()...);
|
||||
any.emplace<void>();
|
||||
} else {
|
||||
any = meta_any{std::invoke(Member, clazz, (args+Indexes)->cast<typename helper_type::template arg_type<Indexes>>()...)};
|
||||
}
|
||||
|
||||
@@ -1373,7 +1373,8 @@ TEST_F(Meta, MetaFuncRetVoid) {
|
||||
|
||||
auto any = func.invoke(instance, 5);
|
||||
|
||||
ASSERT_FALSE(any);
|
||||
ASSERT_TRUE(any);
|
||||
ASSERT_TRUE(any.can_cast<void>());
|
||||
ASSERT_EQ(func_type::value, 25);
|
||||
|
||||
func.prop([](auto prop) {
|
||||
@@ -1442,7 +1443,8 @@ TEST_F(Meta, MetaFuncStaticRetVoid) {
|
||||
|
||||
auto any = func.invoke({}, 42);
|
||||
|
||||
ASSERT_FALSE(any);
|
||||
ASSERT_TRUE(any);
|
||||
ASSERT_TRUE(any.can_cast<void>());
|
||||
ASSERT_EQ(func_type::value, 42);
|
||||
|
||||
func.prop([](auto *prop) {
|
||||
|
||||
Reference in New Issue
Block a user