From 03951d793a88d4bab5364c72b42d8f8ce5898a8c Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 24 Jun 2007 19:27:22 +0000 Subject: [PATCH] * don't try to range check ordconst nodes being actually classes git-svn-id: trunk@7797 - --- .gitattributes | 1 + compiler/ncon.pas | 5 +++-- tests/tbs/tb0539.pp | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tests/tbs/tb0539.pp diff --git a/.gitattributes b/.gitattributes index b2e21a5392..a1a0db8ef5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6333,6 +6333,7 @@ tests/tbs/tb0535.pp svneol=native#text/plain tests/tbs/tb0536.pp svneol=native#text/plain tests/tbs/tb0537.pp svneol=native#text/plain tests/tbs/tb0538.pp svneol=native#text/plain +tests/tbs/tb0539.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/ncon.pas b/compiler/ncon.pas index ab456a898a..52662b5532 100644 --- a/compiler/ncon.pas +++ b/compiler/ncon.pas @@ -621,8 +621,9 @@ implementation begin result:=nil; resultdef:=typedef; - { only do range checking when explicitly asked for it } - if rangecheck then + { only do range checking when explicitly asked for it + and if the type can be range checked, see tests/tbs/tb0539.pp } + if rangecheck and (resultdef.typ in [orddef,enumdef]) then testrange(resultdef,value,false); end; diff --git a/tests/tbs/tb0539.pp b/tests/tbs/tb0539.pp new file mode 100644 index 0000000000..b96a531659 --- /dev/null +++ b/tests/tbs/tb0539.pp @@ -0,0 +1,11 @@ +{$mode delphi} +const + o = TObject(0); + +var + o2 : TObject; + +{$r+} +begin + o2:=o; +end.