diff --git a/.gitattributes b/.gitattributes index cdd34ab9c4..2a2b47464a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16076,6 +16076,7 @@ tests/webtbs/tw3328a.pp svneol=native#text/plain tests/webtbs/tw3328b.pp svneol=native#text/plain tests/webtbs/tw3334.pp svneol=native#text/plain tests/webtbs/tw3340.pp svneol=native#text/plain +tests/webtbs/tw33414.pp svneol=native#text/pascal tests/webtbs/tw33417.pp svneol=native#text/pascal tests/webtbs/tw3348.pp svneol=native#text/plain tests/webtbs/tw3349.pp svneol=native#text/plain diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 6e5aca5450..fdd3162eb1 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -1322,6 +1322,13 @@ implementation else Message1(parser_e_type_cant_be_used_in_array_index,def.typename); end; + { generic parameter? } + undefineddef: + begin + lowval:=0; + highval:=1; + indexdef:=def; + end; else Message(sym_e_error_in_type_def); end; diff --git a/tests/webtbs/tw33414.pp b/tests/webtbs/tw33414.pp new file mode 100644 index 0000000000..766944671b --- /dev/null +++ b/tests/webtbs/tw33414.pp @@ -0,0 +1,20 @@ +{$mode objfpc}{$H+} +uses Classes, SysUtils; + +type + generic TFoo = class + m: array[SomeEnum] of integer; + end; + + TEnum = (e0, e1); + +var + a: specialize TFoo; + +begin + if low(a.m)<>e0 then + halt(1); + if high(a.m)<>e1 then + halt(1); + writeln('ok'); +end.