Browse Source

* ensure that a nested function variable can not be assigned to a function reference

Sven/Sarah Barth 3 years ago
parent
commit
3b7842c30e
1 changed files with 6 additions and 0 deletions
  1. 6 0
      compiler/procdefutil.pas

+ 6 - 0
compiler/procdefutil.pas

@@ -895,6 +895,12 @@ implementation
                 internalerror(2022041804);
                 internalerror(2022041804);
             end;
             end;
         end
         end
+      else if (n.resultdef.typ=procvardef) and
+          (po_delphi_nested_cc in tprocvardef(n.resultdef).procoptions) then
+        begin
+          MessagePos(n.fileinfo,type_e_nested_procvar_to_funcref);
+          exit;
+        end
       else
       else
         pinested:=nil;
         pinested:=nil;