https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123185

            Bug ID: 123185
           Summary: Implicit_Dereference, classwide types, and generic
                    packages don't work together
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liam at liampwll dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Writing a description for this is somewhat difficult so a minimal code example
follows. The emitted error is `error: undefined selector "X" for overloaded
prefix` on the F3 line. This occurs on everything from 8.0 to the current
trunk.

   with Ada.Containers.Indefinite_Vectors;

   generic --  F3 works if this line is removed
   package Foo is
      type R is tagged record
         X : Integer;
      end record;

      package V is new Ada.Containers.Indefinite_Vectors (Positive, R);
      package V_Classwide is new Ada.Containers.Indefinite_Vectors (Positive,
R'Class);

      function F1 (VV : V.Vector) return Integer is (VV (1).X); --  Works
      function F2 (VV : V_Classwide.Vector) return Integer is (VV
(1).Element.X); --  Works
      function F3 (VV : V_Classwide.Vector) return Integer is (VV (1).X); -- 
Doesn't work
   end Foo;

Reply via email to