[Bug ada/49192] New: Misleading error message about unknown discriminant

yannick_duchene at yahoo dot fr gcc-bugzilla@gcc.gnu.org
Fri May 27 14:16:00 GMT 2011


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

           Summary: Misleading error message about unknown discriminant
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: ada
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: yannick_duchene@yahoo.fr


Created attachment 24371
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24371
Example file which produce the erroneous error message

Summary: a package defines a type T with an unknown discriminant; if you
instantiate an entity of that type, giving it (by inadvertence) a discriminant,
then GNATMake will complain “invalid constraint: type has no discriminant”.
This message is misleading and confusing for beginners, as the type actual has
a discriminated view. The Ada compiler should instead complain the discriminant
is unknown, and so any discriminant would fail. Why not: “type discriminant is
unknown, any is invalid” ?

See attached file a a short source file which reproduce this tiny bug.



More information about the Gcc-bugs mailing list