Browse Source

* fix #40410: allow specialization of a procdef also inside exception handlers + added test

Sven/Sarah Barth 1 year ago
parent
commit
287ef8e79a
2 changed files with 22 additions and 1 deletions
  1. 1 1
      compiler/pexpr.pas
  2. 21 0
      tests/webtbs/tw40410.pp

+ 1 - 1
compiler/pexpr.pas

@@ -4485,7 +4485,7 @@ implementation
               end;
               end;
             procdef:
             procdef:
               begin
               begin
-                if block_type<>bt_body then
+                if not (block_type in [bt_body,bt_except]) then
                   begin
                   begin
                     message(parser_e_illegal_expression);
                     message(parser_e_illegal_expression);
                     gensym:=generrorsym;
                     gensym:=generrorsym;

+ 21 - 0
tests/webtbs/tw40410.pp

@@ -0,0 +1,21 @@
+{ %NORUN }
+
+program tw40410;
+
+{$mode delphi}
+
+procedure _Test0<T>(const AParam: T);
+begin
+end;
+
+procedure _Test<T>(const AValue1, AValue2: T);
+begin
+  try
+    _Test0<T>(AValue1);
+  except
+    _Test0<T>(AValue2);
+  end;
+end;
+
+begin
+end.