* change the type of the -gt uninitialised result of ansistring functions to

rawbytestring so the compiler does not try to convert it to the declared
    string type of the function result, as this may not be available
    (mantis #32510)

git-svn-id: trunk@37889 -
This commit is contained in:
Jonas Maebe 2018-01-01 18:04:13 +00:00
parent d448349330
commit c0b0fa9c0b
3 changed files with 33 additions and 6 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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

18
tests/webtbs/tw32510.pp Normal file
View File

@ -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.