diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index 52f948141..d04462885 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -251,9 +251,9 @@ public: * @tparam Type Type of object to use to initialize the wrapper. * @param value An instance of an object to use to initialize the wrapper. */ - template>, meta_any>>> + template, meta_any>>> meta_any(Type &&value) - : meta_any{std::in_place_type>>, std::forward(value)} + : meta_any{std::in_place_type>, std::forward(value)} {} /** @@ -642,11 +642,11 @@ struct meta_handle { * @tparam Type Type of object to use to initialize the handle. * @param value An instance of an object to use to initialize the handle. */ - template>, meta_handle>>> + template, meta_handle>>> meta_handle(Type &value) ENTT_NOEXCEPT : meta_handle{} { - if constexpr(std::is_same_v>, meta_any>) { + if constexpr(std::is_same_v, meta_any>) { any = value.as_ref(); } else { any.emplace(value); diff --git a/test/entt/meta/meta_prop.cpp b/test/entt/meta/meta_prop.cpp index 73173c2cb..2bbbe37e8 100644 --- a/test/entt/meta/meta_prop.cpp +++ b/test/entt/meta/meta_prop.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -18,7 +19,8 @@ struct MetaProp: ::testing::Test { entt::meta() .type("base_2"_hs) - .prop("bool"_hs, false); + .prop("bool"_hs, false) + .prop("char[]"_hs, "char[]"); entt::meta() .type("derived"_hs) @@ -57,6 +59,17 @@ TEST_F(MetaProp, FromBase) { ASSERT_EQ(prop_int.value().cast(), 42); } +TEST_F(MetaProp, DeducedArrayType) { + using namespace entt::literals; + + auto prop = entt::resolve().prop("char[]"_hs); + + ASSERT_TRUE(prop); + ASSERT_EQ(prop.key(), "char[]"_hs); + ASSERT_EQ(prop.value().type(), entt::resolve()); + ASSERT_EQ(std::strcmp(prop.value().cast(), "char[]"), 0); +} + TEST_F(MetaProp, ReRegistration) { using namespace entt::literals;