Browse Source

* fixed regression of webtbs/tw4254: if a constant (wide)string can't be
converted to a pchar at compile time, remove the cstring_to_pchar node
because it expects a stringconstn in pass_generate_code

git-svn-id: trunk@8275 -

Jonas Maebe 18 years ago
parent
commit
d73e79f163
2 changed files with 13 additions and 1 deletions
  1. 11 1
      compiler/ncnv.pas
  2. 2 0
      tests/webtbs/tw4254.pp

+ 11 - 1
compiler/ncnv.pas

@@ -1183,7 +1183,17 @@ implementation
          else
            if is_pchar(resultdef) and
               is_widestring(left.resultdef) then
-             inserttypeconv(left,cansistringtype);
+             begin
+               inserttypeconv(left,cansistringtype);
+               { the second pass of second_cstring_to_pchar expects a  }
+               { strinconstn, but this may become a call to the        }
+               { widestring manager in case left contains "high ascii" }
+               if (left.nodetype<>stringconstn) then
+                 begin
+                   result:=left;
+                   left:=nil;
+                 end;
+             end;
       end;
 
 

+ 2 - 0
tests/webtbs/tw4254.pp

@@ -1,3 +1,5 @@
+{$codepage utf8}
+
 { Source provided for Free Pascal Bug Report 4254 }
 { Submitted by "rimga" on  2005-08-04 }
 { e-mail: [email protected] }