From: Jérémie Astor Date: Sun, 4 Jul 2021 12:46:49 +0000 (+0200) Subject: :art: Prohibit @dtor in struct [Fix] X-Git-Tag: nightly~555 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=ba9316719d3b8fcaa2011655b99f67e13978062b;p=gwion.git :art: Prohibit @dtor in struct [Fix] --- 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);