[Bug ada/15408] New: Overridden functions not recognized

bjorn_persson at sverige dot nu gcc-bugzilla@gcc.gnu.org
Thu May 13 11:26:00 GMT 2004


In the attached files are a generic package with a private abstract tagged type
Parameter_Definition and two abstract functions, a private generic subpackage
with an abstract type Intermediate_Definition derived from Parameter_Definition,
and a generic child package with a private concrete type
Typed_Parameter_Definition derived from Intermediate_Definition. Gnat gives an
incorrect error message on the declaration of Typed_Parameter_Definition:

extracted-discrete_parameters.ads:19:09: type must be declared abstract or
"Meaning" overridden

That function is overridden on line 23. If I take Meaning away I get the same
error saying that Default must be overridden, which I have also done.

GCC-Gnat 3.4.0 and 3.3.2 and ACT-Gnat 3.15p all print the same message, and I
have been told that ACT-Gnat 3.16a1 and 5.02a behave the same. I have also been
told that Apex and ObjectAda compile this without complaint.

For your information, any one of the following changes removes the complaint:
· Deriving Typed_Parameter_Definition directly from Parameter_Definition.
· Removing "private" from the parent package.
· Turning the child package into a private subpackage.
· Removing "is abstract" from the function declarations. (I have checked that
the functions do get overridden in this case.)

I believe this code is legal and Gnat should accept it, but if it really is
illegal then a better message should be printed. The current message is clearly
wrong.

With thanks to the helpful people in comp.lang.ada. (Message ID
HLJmc.58389$mU6.237165@newsb.telia.net with follow-ups.)

-- 
           Summary: Overridden functions not recognized
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bjorn_persson at sverige dot nu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15408



More information about the Gcc-bugs mailing list