Переглянути джерело

+ add tests to ensure that the assignment of nested function variables to function references is forbidden

Sven/Sarah Barth 3 роки тому
батько
коміт
0874521a78
2 змінених файлів з 38 додано та 0 видалено
  1. 19 0
      tests/test/tfuncref35.pp
  2. 19 0
      tests/test/tfuncref36.pp

+ 19 - 0
tests/test/tfuncref35.pp

@@ -0,0 +1,19 @@
+{ %FAIL }
+
+program tfuncref35;
+
+{$mode objfpc}
+{$modeswitch functionreferences}
+{$modeswitch nestedprocvars}
+
+type
+  TProcRef = reference to procedure;
+  TNestedVar = procedure is nested;
+
+var
+  f: TProcRef;
+  v: TNestedVar;
+begin
+  f := v;
+end.
+

+ 19 - 0
tests/test/tfuncref36.pp

@@ -0,0 +1,19 @@
+{ %FAIL }
+
+program tfuncref35;
+
+{$mode delphi}
+{$modeswitch functionreferences}
+{$modeswitch nestedprocvars}
+
+type
+  TProcRef = reference to procedure;
+  TNestedVar = procedure is nested;
+
+var
+  f: TProcRef;
+  v: TNestedVar;
+begin
+  f := v;
+end.
+