generic
      type T1 is tagged private;
   package pak1 is
      type T2 is new T1 with
         record
            i,j: integer;
         end record;

      x1: T2 := T2'(2,3);            -- ERROR:
      x2: T2 := T2'(T1 with 2,3);    -- OK
   end pak1;

The declaration of x1 is illegal because the record_aggregate does not include
all components of x1, violating 4.3.1(16/2).  In this particular case, since
the components inherited from T1 are unknown, the only legal kind of aggregate
is a record_extension_aggregate, as done for x2.

The compiler accepts this illegal program.


-- 
           Summary: Illegal program not detected, RM 4.3.1(16/2)
           Product: gcc
           Version: 4.3.0
            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=38330

Reply via email to