mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 00:02:06 +02:00
* fix for Mantis #37650: apply adjusted patch by Ryan Joseph do not range check the length of ShortStrings if their length parameter is based on a generic constant
+ added test git-svn-id: trunk@46766 -
This commit is contained in:
parent
9a7e977167
commit
b2177fb50e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -18444,6 +18444,7 @@ tests/webtbs/tw37554.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3758.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3764.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3765.pp svneol=native#text/plain
|
||||
tests/webtbs/tw37650.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3768.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3774.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3777.pp svneol=native#text/plain
|
||||
|
@ -114,7 +114,12 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (tordconstnode(p).value<=0) then
|
||||
{ the node is a generic param while parsing a generic def
|
||||
so disable the range checking for the string }
|
||||
if parse_generic and
|
||||
(nf_generic_para in p.flags) then
|
||||
tordconstnode(p).value:=255;
|
||||
if tordconstnode(p).value<=0 then
|
||||
begin
|
||||
Message(parser_e_invalid_string_size);
|
||||
tordconstnode(p).value:=255;
|
||||
|
22
tests/webtbs/tw37650.pp
Normal file
22
tests/webtbs/tw37650.pp
Normal file
@ -0,0 +1,22 @@
|
||||
{ %NORUN }
|
||||
|
||||
program tw37650;
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
type
|
||||
generic TMyClass<const U: Integer> = class
|
||||
type TKey = String[U];
|
||||
end;
|
||||
|
||||
generic procedure Test<const U: Integer>;
|
||||
type
|
||||
TKey = String[U];
|
||||
begin
|
||||
end;
|
||||
|
||||
type
|
||||
TMyClass12 = specialize TMyClass<12>;
|
||||
begin
|
||||
specialize Test<12>;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user