diff --git a/.gitattributes b/.gitattributes index ea16d5368a..37899ea45e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8817,6 +8817,7 @@ tests/webtbs/tw13318.pp svneol=native#text/plain tests/webtbs/tw1333.pp svneol=native#text/plain tests/webtbs/tw13343.pp svneol=native#text/plain tests/webtbs/tw13345x.pp svneol=native#text/plain +tests/webtbs/tw13456.pp svneol=native#text/plain tests/webtbs/tw1348.pp svneol=native#text/plain tests/webtbs/tw1351.pp svneol=native#text/plain tests/webtbs/tw1364.pp svneol=native#text/plain diff --git a/compiler/nadd.pas b/compiler/nadd.pas index 9e004e1e1f..4ead04a5e2 100644 --- a/compiler/nadd.pas +++ b/compiler/nadd.pas @@ -1442,8 +1442,8 @@ implementation ((cs_ansistrings in current_settings.localswitches) and //todo: Move some of this to longstring's then they are implemented? ( - is_pchar(rd) or (is_chararray(rd) and (rd.size > 255)) or is_open_chararray(rd) or - is_pchar(ld) or (is_chararray(ld) and (ld.size > 255)) or is_open_chararray(ld) + is_pchar(rd) or (is_chararray(rd) and (rd.size > 255)) or is_open_chararray(rd) or (lt = stringconstn) or + is_pchar(ld) or (is_chararray(ld) and (ld.size > 255)) or is_open_chararray(ld) or (rt = stringconstn) ) ) then strtype:=st_ansistring diff --git a/tests/webtbs/tw13456.pp b/tests/webtbs/tw13456.pp new file mode 100644 index 0000000000..5cc80d7ca3 --- /dev/null +++ b/tests/webtbs/tw13456.pp @@ -0,0 +1,25 @@ +program test; +{$ifdef fpc} +{$mode delphi$}{$H+} +{$endif} +uses SysUtils; +var + s: string; + s1: string[3]; +begin + s1:='255'; + s:='This is a big long string. This is going to be '+ + 'A really big long string. The idea is it needs '+ + 'to be over '+s1+' characters to see if FPC can '+ + 'handle it. I have a program that isn''t '+ + 'building because of the '+s1+' character string '+ + 'limit. I can''t imagine why I''ve run into '+ + 'this now. It should be wokring just dandy. '+ + 'But for some reason it wasn''t so I thought a '+ + 'test program outside of the project I was '+ + 'working on may be beneficial to analysis.'; + + if (length(s)<=255) then + halt(1); +end. +