mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-11 10:10:40 +01:00
Fix for Mantis #25929
* ninl.pas, tinlinenode.handle_default.getdefaultvarsym:
prefix the default variable's name with a "$zero" instead of a "zero" and use only the string from the second character on for comparisons so that findwithhash() and checkduplicates() generate consistent results
+ added test
git-svn-id: trunk@27320 -
This commit is contained in:
parent
e003e1773c
commit
a08e8ff982
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13862,6 +13862,7 @@ tests/webtbs/tw25869.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2588.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2589.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25895.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25929.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2594.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2595.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2602.pp svneol=native#text/plain
|
||||
|
||||
@ -392,8 +392,8 @@ implementation
|
||||
not (def.typ in [arraydef,recorddef,variantdef,objectdef,procvardef]) or
|
||||
((def.typ=objectdef) and not is_object(def)) then
|
||||
internalerror(201202101);
|
||||
defaultname:=make_mangledname('zero',def.owner,def.typesym.Name);
|
||||
hashedid.id:=defaultname;
|
||||
defaultname:=make_mangledname('$zero',def.owner,def.typesym.Name);
|
||||
hashedid.id:=copy(defaultname,2,255);
|
||||
{ the default sym is always part of the current procedure/function }
|
||||
srsymtable:=current_procinfo.procdef.localst;
|
||||
srsym:=tsym(srsymtable.findwithhash(hashedid));
|
||||
|
||||
25
tests/webtbs/tw25929.pp
Normal file
25
tests/webtbs/tw25929.pp
Normal file
@ -0,0 +1,25 @@
|
||||
{ %NORUN }
|
||||
|
||||
program tw25929;
|
||||
|
||||
{$MODE DELPHI}
|
||||
|
||||
type
|
||||
TR<T> = record
|
||||
end;
|
||||
|
||||
TA<T> = class
|
||||
procedure Foo;
|
||||
end;
|
||||
|
||||
procedure TA<T>.Foo;
|
||||
var
|
||||
r: TR<T>;
|
||||
begin
|
||||
r := Default(TR<T>);
|
||||
r := Default(TR<T>); // Error: Duplicate identifier "zero_$P$PLC03_$$_TR$1"
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user