From 089ff79c3bef4d170d6cd0a9b481cff2d241a8b4 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 21 Jun 2009 12:14:14 +0000 Subject: [PATCH] + test I forgot to commit earlier git-svn-id: trunk@13309 - --- .gitattributes | 1 + tests/test/opt/twpo6.pp | 51 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tests/test/opt/twpo6.pp diff --git a/.gitattributes b/.gitattributes index 46a8ba10f6..7ac3046867 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8010,6 +8010,7 @@ tests/test/opt/twpo2.pp svneol=native#text/plain tests/test/opt/twpo3.pp svneol=native#text/plain tests/test/opt/twpo4.pp svneol=native#text/plain tests/test/opt/twpo5.pp svneol=native#text/plain +tests/test/opt/twpo6.pp svneol=native#text/plain tests/test/opt/twpo7.pp svneol=native#text/plain tests/test/opt/uwpo2.pp svneol=native#text/plain tests/test/packages/fcl-base/tascii85.pp svneol=native#text/plain diff --git a/tests/test/opt/twpo6.pp b/tests/test/opt/twpo6.pp new file mode 100644 index 0000000000..6b22d02bd1 --- /dev/null +++ b/tests/test/opt/twpo6.pp @@ -0,0 +1,51 @@ +{ %wpoparas=devirtcalls,optvmts } +{ %wpopasses=1 } + +{$mode objfpc} +{$m+} + +{ check that multiple descendents properly mark parent class method as + non-optimisable +} + +type + tbase = class + procedure test; virtual; + end; + + tchild1 = class(tbase) + procedure test; override; + end; + + tchild2 = class(tbase) + published + procedure test; override; + end; + +procedure tbase.test; +begin + halt(1); +end; + +var + a: longint; + +procedure tchild1.test; +begin + if a<>1 then + halt(2); +end; + +procedure tchild2.test; +begin + if a<>2 then + halt(3); +end; + +var + bb: tbase; +begin + bb:=tchild1.create; + if (bb is tchild2) then + halt(1); +end.