diff --git a/.gitattributes b/.gitattributes index c04d8105e4..a24c03eb63 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15913,6 +15913,7 @@ tests/webtbs/tw3235.pp svneol=native#text/plain tests/webtbs/tw3235a.pp svneol=native#text/plain tests/webtbs/tw3241a.pp svneol=native#text/plain tests/webtbs/tw32474.pp svneol=native#text/pascal +tests/webtbs/tw32510.pp svneol=native#text/plain tests/webtbs/tw3252.pp svneol=native#text/plain tests/webtbs/tw3255.pp svneol=native#text/plain tests/webtbs/tw3257.pp svneol=native#text/plain diff --git a/compiler/ngenutil.pas b/compiler/ngenutil.pas index 19da58fc57..aaff1b8754 100644 --- a/compiler/ngenutil.pas +++ b/compiler/ngenutil.pas @@ -676,6 +676,7 @@ implementation var size: asizeint; trashintval: int64; + stringres: tstringconstnode; begin if trashable_sym(p) then begin @@ -695,12 +696,19 @@ implementation if is_managed_type(p.vardef) then begin if is_string(p.vardef) then - trash_small(stat,trashn, - cstringconstnode.createstr( - 'uninitialized function result in '+ - tprocdef(p.owner.defowner).customprocname([pno_proctypeoption, pno_paranames,pno_ownername, pno_noclassmarker]) - ) - ) + begin + stringres:= + cstringconstnode.createstr( + 'uninitialized function result in '+ + tprocdef(p.owner.defowner).customprocname([pno_proctypeoption, pno_paranames,pno_ownername, pno_noclassmarker]) + ); + { prevent attempts to convert the string to the specified + code page at compile time, as it may not be available (and + it does not matter) } + if is_ansistring(p.vardef) then + stringres.changestringtype(search_system_type('RAWBYTESTRING').typedef); + trash_small(stat,trashn,stringres); + end else internalerror(2016030601); end diff --git a/tests/webtbs/tw32510.pp b/tests/webtbs/tw32510.pp new file mode 100644 index 0000000000..c874fcf479 --- /dev/null +++ b/tests/webtbs/tw32510.pp @@ -0,0 +1,18 @@ +{ %norun } + +unit tw32510; +interface + +type + RawUnicode = type AnsiString(1200); + +function AnsiToRawUnicode(const AnsiText: RawByteString): RawUnicode; + +implementation + +function AnsiToRawUnicode(const AnsiText: RawByteString): RawUnicode; +begin +end; + +initialization +end.