From 8acbfd0f19edbd8f51af4c4a823f83b2a5c3f8c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 25 May 2020 00:07:15 +0200 Subject: [PATCH] :art: Use typedef flag for pre-defined template function pointer --- src/parse/check.c | 1 + src/parse/scan2.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parse/check.c b/src/parse/check.c index 5a701565..81b4d5ec 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -678,6 +678,7 @@ ANN static Type check_predefined(const Env env, Exp_Call *exp, const Value v, co .scope=scope, .flag=ae_flag_check }; CHECK_BO(envset_push(&es, v->from->owner_class, v->from->owner)) (void)env_push(env, v->from->owner_class, v->from->owner); + SET_FLAG(func->def, typedef); const m_bool ret = traverse_func_def(env, func->def); if(es.run) envset_pop(&es, v->from->owner_class); diff --git a/src/parse/scan2.c b/src/parse/scan2.c index be22079c..8b066b69 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -298,7 +298,7 @@ ANN static m_bool scan2_func_def_overload(const Env env, const Func_Def f, const const m_bool base = tmpl_base(f->base->tmpl); const m_bool tmpl = GET_FLAG(overload, template); if(isa(overload->type, env->gwion->type[et_function]) < 0 || is_fptr(env->gwion, overload->type)) { - if(isa(overload->type, env->gwion->type[et_class]) < 0) + if(!GET_FLAG(f, typedef)) ERR_B(f->pos, _("function name '%s' is already used by another value"), overload->name) } if((!tmpl && base) || (tmpl && !base && !GET_FLAG(f, template))) -- 2.43.0