From b32573d1ebb4c7a33708efe3a6e275bf2fdbd4a1 Mon Sep 17 00:00:00 2001 From: florian <florian@freepascal.org> Date: Sat, 27 Jan 2024 22:05:31 +0100 Subject: [PATCH] * inserting $result into the symtables should never trigger a duplicate symbol error, resolves #40608 --- compiler/pparautl.pas | 2 +- tests/webtbs/tw40608.pp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw40608.pp diff --git a/compiler/pparautl.pas b/compiler/pparautl.pas index 809bddc090..38dcfd0ca8 100644 --- a/compiler/pparautl.pas +++ b/compiler/pparautl.pas @@ -351,7 +351,7 @@ implementation not paramanager.ret_in_param(pd.returndef,pd) then begin vs:=clocalvarsym.create('$result',vs_value,pd.returndef,[vo_is_funcret]); - pd.localst.insertsym(vs); + pd.localst.insertsym(vs,false); pd.funcretsym:=vs; end; diff --git a/tests/webtbs/tw40608.pp b/tests/webtbs/tw40608.pp new file mode 100644 index 0000000000..4d87dd4306 --- /dev/null +++ b/tests/webtbs/tw40608.pp @@ -0,0 +1,13 @@ +{$mode ObjFPC}{$H+} + +generic function genericfunc<T>: String; + + function innerfunc: String; + begin // project1.lpr(6,3) Error: Duplicate identifier "$result" + end; + +begin +end; + +begin +end.