Skip to content

Commit

Permalink
bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Jun 1, 2019
1 parent ddba29c commit 699fb73
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/entt/meta/meta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1848,8 +1848,11 @@ class meta_type {
std::array<meta_any, sizeof...(Args)> arguments{{std::forward<Args>(args)...}};
meta_any any{};

internal::iterate<&internal::meta_type_node::ctor>([data = arguments.data(), &any](auto *curr) -> bool {
any = curr->invoke(data);
internal::find_if<&internal::meta_type_node::ctor>([data = arguments.data(), &any](auto *curr) -> bool {
if(curr->size == sizeof...(args)) {
any = curr->invoke(data);
}

return static_cast<bool>(any);
}, node);

Expand Down
6 changes: 6 additions & 0 deletions test/entt/meta/meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,12 @@ TEST_F(Meta, MetaTypeConstructInvalidArgs) {
ASSERT_FALSE(any);
}

TEST_F(Meta, MetaTypeLessArgs) {
auto type = entt::resolve<derived_type>();
auto any = type.construct(base_type{});
ASSERT_FALSE(any);
}

TEST_F(Meta, MetaTypeConstructCastAndConvert) {
auto type = entt::resolve<derived_type>();
auto any = type.construct(entt::meta_any{derived_type{}}, entt::meta_any{42.}, entt::meta_any{'c'});
Expand Down

0 comments on commit 699fb73

Please sign in to comment.