in the return expression of "make"'s body, the expected type is T,
the aggregate is an extension aggregate, but is not of a type
derived from T through one or more extensions. (This is as
far as my limited understanding of LRM 4.3.2(4) and AARM 4.3.2(5)
goes.) Therefore the compiler should not accept the aggregate.

package Ext is

   type T is tagged private;

   package B is
      function make return T;
   end B;

private
   type T is tagged record
      n: Natural;
   end record;
end Ext;

package body Ext is

   package body B is
      function make return T is
      begin
         return (T with n => 0);  -- here
         --return (n => 0);
      end make;

   end B;

end Ext;

-- 
           Summary: GNAT accepts extension aggregate where expexted type is
                    not extension
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bauhaus at futureapps dot de
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to