In the program below, the full declaration of T2 (in the private part
of the package) is illegal because it conflicts with the public
declaration.  The public declaration defines the discriminant, d1, to
have the value 3 whereas the private declaration specifies the value
to be 4.

GNAT fails to diagnose this error.

-- error not detected
package pak1 is
   -- RM 7.3(13), 4.9.1(1)
   -- check that discriminants statically match
   type T1(d1: integer) is tagged null record;
   type T2 is new T1 (3) with private;
private
   subtype T3 is T1 (4);
   type T2 is new T3 with null record;  -- Error: 3 vs 4
end pak1;

To reproduce:

gnatmake pak1.ads

Error message expected:
pak1.ads:9:8: full view of type "T2" conflicts with public declaration at line
6


-- 
           Summary: Illegal program not detected, RM 7.3(13), 4.9.1(1)
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic at ludovic-brenta dot org


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

Reply via email to