Selaa lähdekoodia

* allow pred/succ on non continous enumerations in delphi mode

git-svn-id: trunk@1878 -
florian 19 vuotta sitten
vanhempi
commit
46ecdc8f94
3 muutettua tiedostoa jossa 15 lisäystä ja 1 poistoa
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/ninl.pas
  3. 12 0
      tests/webtbs/tw4557.pp

+ 1 - 0
.gitattributes

@@ -6389,6 +6389,7 @@ tests/webtbs/tw4520.pp -text svneol=unset#text/plain
 tests/webtbs/tw4529.pp -text svneol=unset#text/plain
 tests/webtbs/tw4537.pp svneol=native#text/plain
 tests/webtbs/tw4540.pp -text svneol=unset#text/plain
+tests/webtbs/tw4557.pp svneol=native#text/plain
 tests/webtbs/tw4566.pp -text svneol=unset#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain

+ 2 - 1
compiler/ninl.pas

@@ -1613,7 +1613,8 @@ implementation
                    else
                      begin
                        if (resulttype.def.deftype=enumdef) and
-                          (tenumdef(resulttype.def).has_jumps) then
+                          (tenumdef(resulttype.def).has_jumps) and
+                          not(m_delphi in aktmodeswitches) then
                          CGMessage(type_e_succ_and_pred_enums_with_assign_not_possible);
                      end;
 

+ 12 - 0
tests/webtbs/tw4557.pp

@@ -0,0 +1,12 @@
+{ Source provided for Free Pascal Bug Report 4557 }
+{ Submitted by "Marek Mauder" on  2005-11-29 }
+{ e-mail: [email protected] }
+program FPCBugs;
+{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}
+type
+  TEnum = (Item1 = 5, Item2 = 10, Item3 = 20);
+var
+  Enum: TEnum = Item1;
+begin
+  Enum := Succ(Enum);
+end.