blueloveTH преди 2 години
родител
ревизия
bbf7304946
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      include/pocketpy/obj.h

+ 2 - 0
include/pocketpy/obj.h

@@ -171,6 +171,8 @@ template <typename T> struct has_gc_marker<T, std::void_t<decltype(&T::_gc_mark)
 
 template <typename T>
 struct Py_ final: PyObject {
+    static_assert(!std::is_reference_v<T>, "T must not be a reference type. Are you using `PK_OBJ_GET(T&, ...)`?");
+
     T _value;
     void _obj_gc_mark() override {
         if constexpr (has_gc_marker<T>::value) {