From b9455f6baebdf14414064f09cd27c955a3a731e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 4 Jul 2021 14:35:50 +0200 Subject: [PATCH] :art: Prohibit @dtor in struct --- src/parse/scan1.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/parse/scan1.c b/src/parse/scan1.c index be809612..c334d507 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -592,7 +592,12 @@ 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") || op == insert_symbol("@gack")) + if (op == insert_symbol("@dtor")) { + if(tflag(env->class_def, tflag_struct)) + ERR_B(base->pos, "can't use '@dtor' for structures"); + return class_internal(env, base); + } + if (op == insert_symbol("@gack")) return class_internal(env, base); if (op == insert_symbol("@implicit")) return scan_internal_arg(env, base); if (op == insert_symbol("@conditional") || -- 2.43.0