blueloveTH 2 лет назад
Родитель
Сommit
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) {