Browse Source

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 -
svenbarth 11 years ago
parent
commit
b0670ee34c
3 changed files with 24 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 4 1
      compiler/ptype.pas
  3. 19 0
      tests/webtbs/tw25600.pp

+ 1 - 0
.gitattributes

@@ -13897,6 +13897,7 @@ tests/webtbs/tw25398.pp svneol=native#text/plain
 tests/webtbs/tw2540.pp svneol=native#text/plain
 tests/webtbs/tw2540.pp svneol=native#text/plain
 tests/webtbs/tw25551.pp svneol=native#text/plain
 tests/webtbs/tw25551.pp svneol=native#text/plain
 tests/webtbs/tw25598.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/tw25603.pp svneol=native#text/pascal
 tests/webtbs/tw2561.pp svneol=native#text/plain
 tests/webtbs/tw2561.pp svneol=native#text/plain
 tests/webtbs/tw25610.pp -text svneol=native#text/plain
 tests/webtbs/tw25610.pp -text svneol=native#text/plain

+ 4 - 1
compiler/ptype.pas

@@ -1286,7 +1286,10 @@ implementation
                                end
                                end
                              else
                              else
                                if not parse_generic then
                                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
                            end
                          else
                          else
                            Message(sym_e_error_in_type_def)
                            Message(sym_e_error_in_type_def)

+ 19 - 0
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<T> = class
+  public
+    class var F: array[0..T.X] of byte; // for normal fields all is ok
+  end;
+
+begin // Fatal: Internal error 200601281
+end.
+