Browse Source

* inserting $result into the symtables should never trigger a duplicate symbol error, resolves #40608

florian 1 year ago
parent
commit
b32573d1eb
2 changed files with 14 additions and 1 deletions
  1. 1 1
      compiler/pparautl.pas
  2. 13 0
      tests/webtbs/tw40608.pp

+ 1 - 1
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;
 

+ 13 - 0
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.