From ba9316719d3b8fcaa2011655b99f67e13978062b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 4 Jul 2021 14:46:49 +0200 Subject: [PATCH] :art: Prohibit @dtor in struct [Fix] --- src/parse/scan1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/parse/scan1.c b/src/parse/scan1.c index c334d507..cf227330 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -593,6 +593,8 @@ ANN static inline m_bool scan_internal_int(const Env env, ANN static m_bool scan_internal(const Env env, const Func_Base *base) { const Symbol op = base->xid; if (op == insert_symbol("@dtor")) { + if(!env->class_def) + ERR_B(base->pos, "'@dtor' must be use in a class"); if(tflag(env->class_def, tflag_struct)) ERR_B(base->pos, "can't use '@dtor' for structures"); return class_internal(env, base); -- 2.43.0