From 3b968b4b353162cb474b39607cfcec79a1d52d15 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Wed, 12 Sep 2012 16:03:09 +0000 Subject: [PATCH] * don't allow overloading enum/int operations, because they should be interpreted as internally define operations in case of enum type definitions in {$mode delphi} (mantis #22860) git-svn-id: trunk@22377 - --- .gitattributes | 1 + compiler/htypechk.pas | 5 +++++ tests/webtbs/tw22860.pp | 43 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 tests/webtbs/tw22860.pp diff --git a/.gitattributes b/.gitattributes index 176336ad2a..9dbba1e2c8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12824,6 +12824,7 @@ tests/webtbs/tw22741.pp svneol=native#text/plain tests/webtbs/tw22744.pp svneol=native#text/pascal tests/webtbs/tw2277.pp svneol=native#text/plain tests/webtbs/tw2280.pp svneol=native#text/plain +tests/webtbs/tw22860.pp svneol=native#text/plain tests/webtbs/tw2289.pp svneol=native#text/plain tests/webtbs/tw2291.pp svneol=native#text/plain tests/webtbs/tw2294.pp svneol=native#text/plain diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index cf1a4d4c2c..f93bb2162a 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -255,6 +255,11 @@ implementation ( is_enum(rd) and (treetyp in (order_theoretic_operators+[addn, subn])) + ) or + ( + { for enum definitions, see webtbs/tw22860.pp } + is_integer(rd) and + (treetyp in (order_theoretic_operators+bit_manipulation_operators+arithmetic_operators)) ) ); end; diff --git a/tests/webtbs/tw22860.pp b/tests/webtbs/tw22860.pp new file mode 100644 index 0000000000..c37c3e4952 --- /dev/null +++ b/tests/webtbs/tw22860.pp @@ -0,0 +1,43 @@ +{ %norun } + +program tw22860; + +{$ifdef fpc} +{$mode delphi} +{$endif} + +type + TZoneID=( + zNone=-1, + zSystem=zNone, // LC system parameters + zOven=0, // GC or LC column temperature + zInj=$10000, + zInjA=zInj, + zInjB=zInj + 1, + zInjC=zInj + 2, + zInjD=zInj + 3, + zDet=$20000, // GC and LC detectors + zDetA=zDet, + zDetB=zDet + 1, + zDetC=zDet + 2, + zDetD=zDet + 3, + zAux=$30000, + zAux1=zAux, + zAux2=zAux + 1, + zAux3=zAux + 2, + //LC + zPump=zInj, + zPumpA=zInjA, + zPumpB=zInjB, + zPumpC=zInjC, + zPumpD=zInjD, + + zEvents = $00040000, //events manager zone + zSampler = $00050000, // autosampler + zDevice = $40000000, // the device itself + zBlock = $20000000 // the block of device + ); + +begin +end. +