------- Comment #1 from anhvofrcaus at gmail dot com 2008-04-23 21:59 ------- The GNAT behaves correctly by printing FAILED because the test code has a problem. When converting Child type to the Parent type, any component(s) of the Child type will be lost. Therefore, Pak1.Eq(Pak1.T1(Z1), Pak1.T1(Z2) should return True (due to the Parent type having null record), and Pak2.Eq(Z1, Z2) should return False because the objects are different obviously. Thus, the equality Pak2.Eq(Z1, Z2) = Pak1.Eq(Pak1.T1(Z1), Pak1.T1(Z2)) should evaluate to False. In summary, the equality should be changed to inequality as shown below.
with Text_IO; use Text_IO; procedure Test1 is package Pak1 is type T1 is tagged null record; function Eq(X, Y: T1) return Boolean renames "="; end Pak1; package Pak2 is type T2 is new Pak1.T1 with record F1: Integer; end record; end Pak2; Z1: Pak2.T2 := (F1 => 1); Z2: Pak2.T2 := (F1 => 2); begin if Pak2.Eq(Z1, Z2) /= Pak1.Eq(Pak1.T1(Z1), Pak1.T1(Z2)) then Put_Line("PASSED"); else Put_Line("FAILED"); end if; end Test1; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32181