equal2.adb
810 Bytes
-
[Ada] Wrong equality on untagged private type · 65641255
When a private type declaration T1 is completed with a derivation of an untagged private type that overrides the predefined equality primitive, and the full view of T2 is a derivation of another private type T2 whose full view is a tagged type, the compiler may generate code that references the wrong equality primitive when processing comparisons of objects of type T1. 2018-05-29 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_N_Op_Eq, Expand_Composite_Equality): Use the new subprogram Inherits_From_Tagged_Full_View to identify more reliably untagged private types completed with a derivation of an untagged private whose full view is a tagged type. * sem_util.ads, sem_util.adb (Inherits_From_Tagged_Full_View): New subprogram. (Collect_Primitive_Operations): Handle untagged private types completed with a derivation of an untagged private type whose full view is a tagged type. In such case, collecting the list of primitives we may find two equality primitives: one associated with the untagged private and another associated with the ultimate tagged type (and we must remove from the returned list this latter one). gcc/testsuite/ * gnat.dg/equal2.adb: New testcase. From-SVN: r260886
Javier Miranda committed