diff options
author | David Snopek <dsnopek@gmail.com> | 2023-08-15 17:35:59 -0500 |
---|---|---|
committer | David Snopek <dsnopek@gmail.com> | 2023-08-15 17:54:11 -0500 |
commit | 3cd3f2415057d90bbb5831f4caee63100d5d8e3c (patch) | |
tree | 089942d6205f90b994df881516ef8c142a0741d3 /include/godot_cpp | |
parent | df5500565a2fd18e7a505ac09c1230dc7b3b6b9d (diff) | |
download | redot-cpp-3cd3f2415057d90bbb5831f4caee63100d5d8e3c.tar.gz |
Ensure that PtrToArg specializations for native structs are used
Diffstat (limited to 'include/godot_cpp')
-rw-r--r-- | include/godot_cpp/core/method_ptrcall.hpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/godot_cpp/core/method_ptrcall.hpp b/include/godot_cpp/core/method_ptrcall.hpp index a85cbc9..32f3f45 100644 --- a/include/godot_cpp/core/method_ptrcall.hpp +++ b/include/godot_cpp/core/method_ptrcall.hpp @@ -168,6 +168,7 @@ MAKE_PTRARG_BY_REFERENCE(Variant); template <class T> struct PtrToArg<T *> { + static_assert(std::is_base_of<Object, T>::value, "Cannot encode non-Object value as an Object"); _FORCE_INLINE_ static T *convert(const void *p_ptr) { return reinterpret_cast<T *>(godot::internal::get_object_instance_binding(*reinterpret_cast<GDExtensionObjectPtr *>(const_cast<void *>(p_ptr)))); } @@ -179,6 +180,7 @@ struct PtrToArg<T *> { template <class T> struct PtrToArg<const T *> { + static_assert(std::is_base_of<Object, T>::value, "Cannot encode non-Object value as an Object"); _FORCE_INLINE_ static const T *convert(const void *p_ptr) { return reinterpret_cast<const T *>(godot::internal::get_object_instance_binding(*reinterpret_cast<GDExtensionObjectPtr *>(const_cast<void *>(p_ptr)))); } |