From fb6733c21e0b5ec8bd96ccb776096ce3d59fc49a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 25 May 2020 01:24:16 +0200 Subject: [PATCH] :art: Prevent writing same template --- src/parse/scan2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); -- 2.43.0