mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 14:08:09 +02:00
default value: fix issue with inlining
Ensure the mangled name is always the same Resolves #40404
This commit is contained in:
parent
6ab91262b2
commit
1be7416816
@ -475,14 +475,15 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{ no valid default variable found, so create it }
|
{ no valid default variable found, so create it }
|
||||||
srsym:=cstaticvarsym.create(defaultname,vs_const,def,[]);
|
srsym:=cstaticvarsym.create(defaultname,vs_const,def,[]);
|
||||||
srsymtable.insertsym(srsym);
|
|
||||||
cnodeutils.insertbssdata(tstaticvarsym(srsym));
|
|
||||||
|
|
||||||
{ mark the staticvarsym as typedconst }
|
{ mark the staticvarsym as typedconst }
|
||||||
include(tabstractvarsym(srsym).varoptions,vo_is_typed_const);
|
include(tabstractvarsym(srsym).varoptions,vo_is_typed_const);
|
||||||
include(tabstractvarsym(srsym).varoptions,vo_is_default_var);
|
include(tabstractvarsym(srsym).varoptions,vo_is_default_var);
|
||||||
{ The variable has a value assigned }
|
{ The variable has a value assigned }
|
||||||
tabstractvarsym(srsym).varstate:=vs_initialised;
|
tabstractvarsym(srsym).varstate:=vs_initialised;
|
||||||
|
|
||||||
|
srsymtable.insertsym(srsym);
|
||||||
|
cnodeutils.insertbssdata(tstaticvarsym(srsym));
|
||||||
|
|
||||||
end;
|
end;
|
||||||
result:=cloadnode.create(srsym,srsymtable);
|
result:=cloadnode.create(srsym,srsymtable);
|
||||||
end
|
end
|
||||||
|
5
tests/webtbs/tw40395c.pp
Normal file
5
tests/webtbs/tw40395c.pp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
uses uw40395c;
|
||||||
|
|
||||||
|
begin
|
||||||
|
test;
|
||||||
|
end.
|
21
tests/webtbs/uw40395c.pp
Normal file
21
tests/webtbs/uw40395c.pp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
unit uw40395c;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
type
|
||||||
|
trec = record
|
||||||
|
a,b,c,d: longint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure test; inline;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure test; inline;
|
||||||
|
var
|
||||||
|
r: trec;
|
||||||
|
begin
|
||||||
|
r:=default(trec);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user