Răsfoiți Sursa

* in {$h+} mode, always treat string constants as if they were ansistrings
when determining the result of string concatenations (mantis #13456)

git-svn-id: trunk@13004 -

Jonas Maebe 16 ani în urmă
părinte
comite
626a723f8c
3 a modificat fișierele cu 28 adăugiri și 2 ștergeri
  1. 1 0
      .gitattributes
  2. 2 2
      compiler/nadd.pas
  3. 25 0
      tests/webtbs/tw13456.pp

+ 1 - 0
.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

+ 2 - 2
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

+ 25 - 0
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.
+