From bbf7304946978acd4a620edeccae7610dcf7b563 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 1 Mar 2024 16:52:21 +0800 Subject: [PATCH] fix a common bad usage --- include/pocketpy/obj.h | 2 ++ 1 file changed, 2 insertions(+) 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) {