From: fennecdjay Date: Wed, 21 Feb 2024 20:54:07 +0000 (+0100) Subject: :art: improve pre_ctor diagnostics X-Git-Tag: nightly~62 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=0ee38df743fdcff80fa933ce32ab3da6203e44a5;p=gwion.git :art: improve pre_ctor diagnostics --- diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 83cdb98b..0d9b565a 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -588,7 +588,7 @@ ANN bool scan1_union_def(const Env env, const Union_Def udef) { #define scan1_stmt_retry dummy_func ANN static bool scan1_stmt_return(const Env env, const Stmt_Exp stmt) { - if (!env->func) + if (!env->func || is_ctor(env->func->def)) ERR_B(stmt_self(stmt)->loc, _("'return' statement found outside function definition")); if (env->scope->depth == 1) env->func->memoize = 1;