Browse Source

meta: refine policy check on value types for non-member data

Michele Caini 2 years ago
parent
commit
59abfbfb5a
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/entt/meta/factory.hpp

+ 6 - 1
src/entt/meta/factory.hpp

@@ -287,7 +287,12 @@ public:
             bucket = &elem.prop;
             bucket = &elem.prop;
         } else {
         } else {
             using data_type = std::remove_pointer_t<decltype(Data)>;
             using data_type = std::remove_pointer_t<decltype(Data)>;
-            static_assert(Policy::template value<data_type>, "Invalid return type for the given policy");
+
+            if constexpr(std::is_pointer_v<decltype(Data)>) {
+                static_assert(Policy::template value<decltype(*Data)>, "Invalid return type for the given policy");
+            } else {
+                static_assert(Policy::template value<data_type>, "Invalid return type for the given policy");
+            }
 
 
             auto &&elem = internal::meta_extend(
             auto &&elem = internal::meta_extend(
                 internal::owner(*ctx, *info),
                 internal::owner(*ctx, *info),