From 5848637db3aab0ac184d96df7cf56ec861f0ad89 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 26 Dec 2014 18:14:52 +0000 Subject: [PATCH] Fix generation of class names for specializations. symdef.pas, tstoreddef: * is_specialization: fix exit condition to correctly recognize specializations + added test git-svn-id: trunk@29328 - --- .gitattributes | 1 + compiler/symdef.pas | 2 +- tests/test/tgeneric97.pp | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/test/tgeneric97.pp diff --git a/.gitattributes b/.gitattributes index ea7641c39d..1b0fdbd6d3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11700,6 +11700,7 @@ tests/test/tgeneric93.pp svneol=native#text/pascal tests/test/tgeneric94.pp svneol=native#text/pascal tests/test/tgeneric95.pp svneol=native#text/pascal tests/test/tgeneric96.pp svneol=native#text/pascal +tests/test/tgeneric97.pp svneol=native#text/pascal tests/test/tgoto.pp svneol=native#text/plain tests/test/theap.pp svneol=native#text/plain tests/test/theapthread.pp svneol=native#text/plain diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 8d3405ea19..3795337b3f 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -2116,7 +2116,7 @@ implementation sym:=tsym(genericparas[i]); if sym.typ<>symconst.typesym then internalerror(2014050904); - if sym.owner.defowner=self then + if sym.owner.defowner<>self then exit(true); end; result:=false; diff --git a/tests/test/tgeneric97.pp b/tests/test/tgeneric97.pp new file mode 100644 index 0000000000..cfb1434d53 --- /dev/null +++ b/tests/test/tgeneric97.pp @@ -0,0 +1,18 @@ +program tgeneric97; + +{$mode objfpc} + +type + generic TTest = class + + end; + + TTestLongInt = specialize TTest; + TTestString = specialize TTest; + +begin + if LowerCase(TTestLongInt.ClassName) <> 'ttest' then + halt(1); + if LowerCase(TTestString.ClassName) <> 'ttest' then + halt(2); +end.