The follow program results in a warning at the indicated position.  As far as I
can tell, the warning is a false positive.

Code like this one immediately suggests itself if you've got two parallel type
hierarchies (and Bar is actually a dispatching operation on the second type
which is not shown here).  IMHO, it makes sense to suppress the warning in this
case.

procedure Classwide_Out is

   type Foo is abstract tagged null record;

   type Foo_Real is new Foo with record
      X : Integer;
   end record;

   procedure Bar (F : out Foo'Class) is
      F2 : Foo_Real renames Foo_Real (F);
      --  warning: "F" may be referenced before it has a value

   begin
      F2.X := 0;
   end Bar;

   F : Foo_Real;

begin
   Bar (F);
end Classwide_Out;

-- 
           Summary: Unnecessary warning for class-wide out parameters
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fw at deneb dot enyo dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to