From a12f2937813f0ae08f31c4b3b575c233f7e29c4e Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Fri, 14 Jul 2006 17:16:27 +0000 Subject: [PATCH] * fixed wrong note about explictly valued enumeration types if the lower bound is <= -1 git-svn-id: trunk@4182 - --- .gitattributes | 1 + compiler/ptype.pas | 6 ++++-- tests/tbs/tb0502.pp | 10 ++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tests/tbs/tb0502.pp diff --git a/.gitattributes b/.gitattributes index ead8e9ab08..b127773138 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5763,6 +5763,7 @@ tests/tbs/tb0498.pp svneol=native#text/plain tests/tbs/tb0499.pp svneol=native#text/plain tests/tbs/tb0500.pp svneol=native#text/plain tests/tbs/tb0501.pp svneol=native#text/plain +tests/tbs/tb0502.pp svneol=native#text/plain tests/tbs/ub0060.pp svneol=native#text/plain tests/tbs/ub0069.pp svneol=native#text/plain tests/tbs/ub0119.pp svneol=native#text/plain diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 3613faa78a..9a105b8a04 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -590,7 +590,7 @@ implementation p : tnode; pd : tabstractprocdef; is_func, - enumdupmsg : boolean; + enumdupmsg, first : boolean; newtype : ttypesym; oldlocalswitches : tlocalswitches; begin @@ -603,6 +603,7 @@ implementation _LKLAMMER: begin consume(_LKLAMMER); + first := true; { allow negativ value_str } l:=-1; enumdupmsg:=false; @@ -641,7 +642,7 @@ implementation p.free; { please leave that a note, allows type save } { declarations in the win32 units ! } - if (v<=l) and (not enumdupmsg) then + if (not first) and (v<=l) and (not enumdupmsg) then begin Message(parser_n_duplicate_enum); enumdupmsg:=true; @@ -650,6 +651,7 @@ implementation end else inc(l); + first := false; storepos:=akttokenpos; akttokenpos:=defpos; tstoredsymtable(aktenumdef.owner).insert(tenumsym.create(s,aktenumdef,l)); diff --git a/tests/tbs/tb0502.pp b/tests/tbs/tb0502.pp new file mode 100644 index 0000000000..3b6877d7d2 --- /dev/null +++ b/tests/tbs/tb0502.pp @@ -0,0 +1,10 @@ +{ %norun } +{ %opt=-Sen } +type + TRegister = ( + TRegisterLowEnum := Low(longint), + TRegisterHighEnum := High(longint) + ); + +begin +end.