From: Jérémie Astor Date: Sun, 24 May 2020 23:24:16 +0000 (+0200) Subject: :art: Prevent writing same template X-Git-Tag: nightly~1516 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=fb6733c21e0b5ec8bd96ccb776096ce3d59fc49a;p=gwion.git :art: Prevent writing same template --- diff --git a/src/parse/scan2.c b/src/parse/scan2.c index 8b066b69..3bb0c31e 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -373,8 +373,9 @@ ANN2(1, 2) static m_bool scan2_fdef_tmpl(const Env env, const Func_Def f, const ++i; continue; } - m_bool ret = compat_func(ff->def, f); - if(ret > 0) { + if(compat_func(ff->def, f) > 0) { + if(ff->value_ref->from->owner == env->curr) + ERR_B(f->pos, "template function '%s' already defined with those arguments in this namespace", name) const Symbol sym = func_symbol(env, env->curr->name, name, "template", ff->vt_index); nspc_add_value(env->curr, sym, value);