From 1b4c7b5a3eee6c80fbe7af782fb0c8e698fab478 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 30 Aug 2005 06:23:31 +0000 Subject: [PATCH] * fix default parameter compare for widestring git-svn-id: trunk@982 - --- .gitattributes | 1 + compiler/symutil.pas | 8 +++++++- tests/webtbs/tw4294.pp | 27 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 tests/webtbs/tw4294.pp diff --git a/.gitattributes b/.gitattributes index c62ce7b0b4..091d4f454d 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/symutil.pas b/compiler/symutil.pas index fb28a90c02..6e9c87b1a8 100644 --- a/compiler/symutil.pas +++ b/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 : diff --git a/tests/webtbs/tw4294.pp b/tests/webtbs/tw4294.pp new file mode 100755 index 0000000000..cc5d027304 --- /dev/null +++ b/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.