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

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
This boils down to:

with Q; Use Q;

procedure P is
   A: Root'Class := Create;
begin
   A := Create;
end;
with Ada.Finalization; use Ada.Finalization;

package Q is

   type Root is interface;

   type Object is new Controlled and Root with null record;

   function Create return Root'Class;

end Q;
package body Q is

   function Inner return Object is
      O : Object;
   begin
      return O;
   end;

   function Create return Root'Class is
   begin
      return Inner;
   end;

end Q;
eric@polaris:~/build/gcc/native> ./p

raised CONSTRAINT_ERROR : p.adb:6 tag check failed

Reply via email to