From 50f2aab0ef2bd2e5379b39030bd7463d15b4d56a Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 16 Sep 2016 15:13:27 +0000 Subject: [PATCH] * fix for Mantis #22192: handle the case that a specialization has the same name as the generic it's based on as in that case the typedef of the symbol is an errordef; therefor we need to use the symbol's real name + added test git-svn-id: trunk@34530 - --- .gitattributes | 1 + compiler/pexpr.pas | 7 ++++++- tests/webtbs/tw22192.pp | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw22192.pp diff --git a/.gitattributes b/.gitattributes index 6bdbc5e5cc..8881c507a4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14740,6 +14740,7 @@ tests/webtbs/tw22154.pp svneol=native#text/pascal tests/webtbs/tw22155.pp svneol=native#text/plain tests/webtbs/tw22160a1.pp svneol=native#text/pascal tests/webtbs/tw22160b1.pp svneol=native#text/pascal +tests/webtbs/tw22192.pp svneol=native#text/pascal tests/webtbs/tw2220.pp svneol=native#text/plain tests/webtbs/tw22225.pp svneol=native#text/pascal tests/webtbs/tw2226.pp svneol=native#text/plain diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 006d7e49c0..043c0fc4e5 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -1409,6 +1409,7 @@ implementation function handle_specialize_inline_specialization(var srsym:tsym;out srsymtable:tsymtable;out spezcontext:tspecializationcontext):boolean; var spezdef : tdef; + symname : tsymstr; begin result:=false; spezcontext:=nil; @@ -1424,7 +1425,11 @@ implementation spezdef:=ttypesym(srsym).typedef else spezdef:=tdef(tprocsym(srsym).procdeflist[0]); - spezdef:=generate_specialization_phase1(spezcontext,spezdef); + if (spezdef.typ=errordef) and (sp_generic_dummy in srsym.symoptions) then + symname:=srsym.RealName + else + symname:=''; + spezdef:=generate_specialization_phase1(spezcontext,spezdef,symname); case spezdef.typ of errordef: begin diff --git a/tests/webtbs/tw22192.pp b/tests/webtbs/tw22192.pp new file mode 100644 index 0000000000..2a268c94f7 --- /dev/null +++ b/tests/webtbs/tw22192.pp @@ -0,0 +1,10 @@ +{ %NORUN } + +{$MODE DELPHI} + + type + TWrapper = record end; + TWrapper = TWrapper; + + begin + end.