mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-11 14:48:47 +02:00
Fix for Mantis #26271: Don't trash local variables that are used for the Default() intrinsic.
* ngenutil.pas, tnodeutils.trashable_sym: check for vo_is_default_var flag and don't consider such as trashable + added test git-svn-id: trunk@27872 -
This commit is contained in:
parent
a025a87c19
commit
4a0d27ebfe
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13944,6 +13944,7 @@ tests/webtbs/tw26226.pp -text svneol=native#text/plain
|
||||
tests/webtbs/tw26230.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2626.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2627.pp svneol=native#text/plain
|
||||
tests/webtbs/tw26271.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2631.pp svneol=native#text/plain
|
||||
tests/webtbs/tw26408.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2643.pp svneol=native#text/plain
|
||||
|
@ -407,6 +407,7 @@ implementation
|
||||
((p.typ=paravarsym) and
|
||||
((vo_is_funcret in tabstractnormalvarsym(p).varoptions) or
|
||||
(tabstractnormalvarsym(p).varspez=vs_out)))) and
|
||||
not (vo_is_default_var in tabstractnormalvarsym(p).varoptions) and
|
||||
not is_managed_type(tabstractnormalvarsym(p).vardef) and
|
||||
not assigned(tabstractnormalvarsym(p).defaultconstsym);
|
||||
end;
|
||||
|
17
tests/webtbs/tw26271.pp
Normal file
17
tests/webtbs/tw26271.pp
Normal file
@ -0,0 +1,17 @@
|
||||
{ %NORUN }
|
||||
|
||||
{$MODE OBJFPC}
|
||||
program tw26271;
|
||||
|
||||
type
|
||||
TRecord = record
|
||||
Member: Pointer;
|
||||
end;
|
||||
|
||||
function TestFunction(): TRecord;
|
||||
begin // test.pas(10,1) Error: Can't assign values to const variable
|
||||
Result := Default(TRecord);
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user