diff --git a/include/pocketpy/obj.h b/include/pocketpy/obj.h index bf76e63c..6ac99848 100644 --- a/include/pocketpy/obj.h +++ b/include/pocketpy/obj.h @@ -171,6 +171,8 @@ template struct has_gc_marker struct Py_ final: PyObject { + static_assert(!std::is_reference_v, "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::value) {