https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95664
Jean-Pierre Rosen <rosen at adalog dot fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rosen at adalog dot fr --- Comment #2 from Jean-Pierre Rosen <rosen at adalog dot fr> --- This is fixed in the development version of AdaControl. Patch: - package Declarations_Store is new Scope_Manager.Scoped_Store (Asis.Declaration); + package Declarations_Store is new Scope_Manager.Scoped_Store (Asis.Declaration, + Equivalent_Keys => Asis.Elements.Is_Equal); There is a hole in the language about this case. I reported to AdaCore, and here is Tucker Taft's response: After looking through the RM, it seems that the use of an abstract "=" in this context is not directly covered, but the closest thing is the rule about what happens when you wrap a type with an abstract "=" into a record or array type. The abstract "=" raises Program_Error if it is ever invoked. See RM 4.5.2 (24.1/3): 24.1/3 {AI05-0123-1} If the primitive equals operator for an untagged record type is abstract, then Program_Error is raised at the point of any (implicit) call to that abstract subprogram. 24.f/3 Reason: An explicit call to an abstract subprogram is illegal. This rule is needed in order to define the effect of an implicit call such as a call that is part of the predefined equality operation for an enclosing composite type that has a component of an untagged record type that has an abstract primitive equals operator. For tagged types, an abstract primitive equals operator is only allowed for an abstract type, and abstract types cannot be components, so this case does not occur. So my sense is that this should *not* be a compile-time error, but rather raise Program_Error if the "=" operator of the formal type is invoked. We also should write up an AI to at least clarify this particular case. We could try to make this illegal in the generic spec, but clearly we cannot make it illegal in the generic body, because of contract issues. But I think the same argument applies here, namely that there is no need to disallow this instantiation, unless "=" is actually used, which argues for raising Program_Error rather than making it illegal.