From b0670ee34c7c9c40c790d9c3ab115e1872617e96 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 11 Apr 2014 14:57:23 +0000 Subject: [PATCH] Fix for Mantis #25600. ptype.pas, read_named_type.array_dec: * generate a valid range definition if we are inside a generic and the array bounds are not ordinals (Note: the check for "parse_generic" should be improved to really detect erratic indexes that are not related to generics in any way) + added test git-svn-id: trunk@27532 - --- .gitattributes | 1 + compiler/ptype.pas | 5 ++++- tests/webtbs/tw25600.pp | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw25600.pp diff --git a/.gitattributes b/.gitattributes index 3e5751a9e5..b53db1d438 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13897,6 +13897,7 @@ tests/webtbs/tw25398.pp svneol=native#text/plain tests/webtbs/tw2540.pp svneol=native#text/plain tests/webtbs/tw25551.pp svneol=native#text/plain tests/webtbs/tw25598.pp svneol=native#text/plain +tests/webtbs/tw25600.pp svneol=native#text/pascal tests/webtbs/tw25603.pp svneol=native#text/pascal tests/webtbs/tw2561.pp svneol=native#text/plain tests/webtbs/tw25610.pp -text svneol=native#text/plain diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 2231cece44..2b60dd6bf4 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -1286,7 +1286,10 @@ implementation end else if not parse_generic then - Message(type_e_cant_eval_constant_expr); + Message(type_e_cant_eval_constant_expr) + else + { we need a valid range for debug information } + range_to_type(lowval,highval,indexdef); end else Message(sym_e_error_in_type_def) diff --git a/tests/webtbs/tw25600.pp b/tests/webtbs/tw25600.pp new file mode 100644 index 0000000000..3e44c2f1a6 --- /dev/null +++ b/tests/webtbs/tw25600.pp @@ -0,0 +1,19 @@ +{ %NORUN } +{ %OPT=-g } + +program tw25600; + +{$MODE DELPHI} + +type + // maybe related to + // http://bugs.freepascal.org/view.php?id=25599 + // http://bugs.freepascal.org/view.php?id=24848 + TC = class + public + class var F: array[0..T.X] of byte; // for normal fields all is ok + end; + +begin // Fatal: Internal error 200601281 +end. +