From 7e4750ac50e65180b9989e6b4c8e88ddefe81e1f Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Fri, 28 Mar 2008 10:15:33 +0000 Subject: [PATCH] * workaround for default property constant value limitations git-svn-id: trunk@10575 - --- .gitattributes | 1 + compiler/pdecvar.pas | 4 ++-- tests/tbs/tb0547.pp | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 tests/tbs/tb0547.pp diff --git a/.gitattributes b/.gitattributes index f150e5b15b..051a30f261 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6830,6 +6830,7 @@ tests/tbs/tb0543.pp svneol=native#text/plain tests/tbs/tb0544.pp svneol=native#text/plain tests/tbs/tb0545.pp svneol=native#text/plain tests/tbs/tb0546.pp svneol=native#text/plain +tests/tbs/tb0547.pp svneol=native#text/plain tests/tbs/tb205.pp svneol=native#text/plain tests/tbs/ub0060.pp svneol=native#text/plain tests/tbs/ub0069.pp svneol=native#text/plain diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index 4ae7c44a35..40d25dbbd3 100644 --- a/compiler/pdecvar.pas +++ b/compiler/pdecvar.pas @@ -605,8 +605,8 @@ implementation setconstn : p.default:=plongint(tsetconstnode(pt).value_set)^; ordconstn : - if (Tordconstnode(pt).valueint64(high(p.default))) then + if (Tordconstnode(pt).valueint64(high(cardinal))) then message(parser_e_range_check_error) else p.default:=longint(tordconstnode(pt).value.svalue); diff --git a/tests/tbs/tb0547.pp b/tests/tbs/tb0547.pp new file mode 100644 index 0000000000..d71451ddea --- /dev/null +++ b/tests/tbs/tb0547.pp @@ -0,0 +1,21 @@ +{ %norun } + +program rangeerror; +{$ifdef FPC}{$mode objfpc}{$h+}{$endif} +{$ifdef mswindows}{$apptype console}{$endif} +uses +{$ifdef FPC}{$ifdef linux}cthreads,{$endif}{$endif} +sysutils; +type +colorty = type longword; +const +cl_mapped = colorty($90000000); +type +ttestclass = class + private + fcolor: colorty; + published + property color: colorty read fcolor write fcolor default cl_mapped; //<<-- +end; +begin +end.