浏览代码

Merged revisions 638 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@639 -

florian 20 年之前
父节点
当前提交
98980d4396
共有 3 个文件被更改,包括 23 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 4 1
      compiler/ncnv.pas
  3. 18 0
      tests/webtbs/tw4155.pp

+ 1 - 0
.gitattributes

@@ -5942,6 +5942,7 @@ tests/webtbs/tw4089.pp svneol=native#text/plain
 tests/webtbs/tw4093.pp svneol=native#text/plain
 tests/webtbs/tw4115.pp svneol=native#text/plain
 tests/webtbs/tw4150.pp svneol=native#text/plain
+tests/webtbs/tw4155.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 4 - 1
compiler/ncnv.pas

@@ -806,7 +806,10 @@ implementation
               if tstringdef(resulttype.def).string_typ=st_widestring then
                begin
                  initwidestring(ws);
-                 concatwidestringchar(ws,tcompilerwidechar(chr(tordconstnode(left).value)));
+                 if torddef(left.resulttype.def).typ=uwidechar then
+                   concatwidestringchar(ws,tcompilerwidechar(tordconstnode(left).value))
+                 else
+                   concatwidestringchar(ws,tcompilerwidechar(chr(tordconstnode(left).value)));
                  hp:=cstringconstnode.createwstr(ws);
                  donewidestring(ws);
                end

+ 18 - 0
tests/webtbs/tw4155.pp

@@ -0,0 +1,18 @@
+{ %OPT=-Fcutf8}
+{ Source provided for Free Pascal Bug Report 4155 }
+{ Submitted by "rimga" on  2005-07-04 }
+{ e-mail: [email protected] }
+{this file encoded in UTF8}
+{cmd fpc twchar.pas -FcUTF8}
+var
+  c: widestring;
+  c2: widestring;
+begin
+  c:= 'ą';      //problem handling char constants
+  c2:= 'ąa';
+  if c[1]<>c2[1] then
+    WriteLn('problem')
+  else
+    Writeln('OK');
+  Readln;
+end.