]> Nishi Git Mirror - gwion.git/commitdiff
:art: Prohibit @dtor in struct
authorJérémie Astor <fennecdjay@gmail.com>
Sun, 4 Jul 2021 12:35:50 +0000 (14:35 +0200)
committerJérémie Astor <fennecdjay@gmail.com>
Sun, 4 Jul 2021 12:35:50 +0000 (14:35 +0200)
src/parse/scan1.c

index be80961269b2401cdc9b80750cc3b5b38d961425..c334d507492aae3ebe86df03433b3fe3f118b30f 100644 (file)
@@ -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") ||