Просмотр исходного кода

* fix default parameter compare for widestring

git-svn-id: trunk@982 -
peter 20 лет назад
Родитель
Сommit
1b4c7b5a3e
3 измененных файлов с 35 добавлено и 1 удалено
  1. 1 0
      .gitattributes
  2. 7 1
      compiler/symutil.pas
  3. 27 0
      tests/webtbs/tw4294.pp

+ 1 - 0
.gitattributes

@@ -6187,6 +6187,7 @@ tests/webtbs/tw4247.pp svneol=native#text/plain
 tests/webtbs/tw4253.pp svneol=native#text/plain
 tests/webtbs/tw4260.pp svneol=native#text/plain
 tests/webtbs/tw4277.pp svneol=native#text/plain
+tests/webtbs/tw4294.pp svneol=native#text/plain
 tests/webtbs/tw4308.pp svneol=native#text/plain
 tests/webtbs/tw4336.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain

+ 7 - 1
compiler/symutil.pas

@@ -41,7 +41,7 @@ implementation
 
     uses
        globtype,cpuinfo,procinfo,
-       symconst;
+       symconst,widestr;
 
 
     function is_funcret_sym(p:tsymentry):boolean;
@@ -89,6 +89,12 @@ implementation
                    equal_constsym:=true;
                 end;
              end;
+           constwstring :
+             begin
+               if (sym1.value.len=sym2.value.len) and
+                  (comparewidestrings(sym1.value.valueptr,sym2.value.valueptr)=0) then
+                 equal_constsym:=true;
+             end;
            constreal :
              equal_constsym:=(pbestreal(sym1.value.valueptr)^=pbestreal(sym2.value.valueptr)^);
            constset :

+ 27 - 0
tests/webtbs/tw4294.pp

@@ -0,0 +1,27 @@
+{ Source provided for Free Pascal Bug Report 4294 }
+{ Submitted by "Martin Schreiber" on  2005-08-19 }
+{ e-mail:  }
+unit tw4294;
+interface
+{$ifdef fpc}{$mode objfpc}{$endif}
+{$H+}
+
+const
+ widestrconst = widestring('abc');
+ ansistrconst = 'abc';
+
+procedure wtest(const par1: widestring = widestrconst);
+procedure atest(const par1: string = ansistrconst);
+
+implementation
+
+procedure atest(const par1: string = ansistrconst); //ok
+begin
+end;
+
+procedure wtest(const par1: widestring = widestrconst); //error
+//procedure wtest(const par1: widestring);              //ok
+begin
+end;
+
+end.