diff --git a/.gitattributes b/.gitattributes index 5d11c78eac..7a72bf419e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/ninl.pas b/compiler/ninl.pas index 68a6340919..758e466137 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -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)); diff --git a/tests/webtbs/tw25929.pp b/tests/webtbs/tw25929.pp new file mode 100644 index 0000000000..311b65aebe --- /dev/null +++ b/tests/webtbs/tw25929.pp @@ -0,0 +1,25 @@ +{ %NORUN } + +program tw25929; + +{$MODE DELPHI} + +type + TR = record + end; + + TA = class + procedure Foo; + end; + +procedure TA.Foo; +var + r: TR; +begin + r := Default(TR); + r := Default(TR); // Error: Duplicate identifier "zero_$P$PLC03_$$_TR$1" +end; + +begin +end. +