Browse Source

Fixing a bug where an empty postfix for enum was allowed

Frederic Kehrein 9 months ago
parent
commit
6618c0dbf7
2 changed files with 16 additions and 1 deletions
  1. 7 1
      compiler/pexpr.pas
  2. 9 0
      tests/test/tenum7.pp

+ 7 - 1
compiler/pexpr.pas

@@ -2608,7 +2608,13 @@ implementation
                                p1:=cerrornode.create;
                                p1:=cerrornode.create;
                                consume(_ID);
                                consume(_ID);
                              end;
                              end;
-                       end;
+                       end
+                     else
+                       begin
+                         p1.destroy;
+                         p1:=cerrornode.create;
+                         consume(_ID);
+                       end
                    end;
                    end;
                  arraydef:
                  arraydef:
                    begin
                    begin

+ 9 - 0
tests/test/tenum7.pp

@@ -0,0 +1,9 @@
+{ %FAIL }
+program casedottest;
+{$mode ObjFpc}
+type
+  TShape=(shRectangle, shEllipse, shNone);
+var
+  A: TShape.;
+begin
+end.