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

            Bug ID: 126416
           Summary: Weird error message for premature usage of incomplete
                    type.
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: p.p11 at orange dot fr
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 65133
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65133&action=edit
Reproducer.

Reproducer (source code in attached file):
% gcc -c -gnatlf test39.adb
GNAT 16.1.0
     1. procedure Test39 is
     2.
     3.    --    Section_13_14_Paragraph_10.c
     4.    package P1 is
     5.      function Func_Call return Natural is (99);
     6.      type T is private;
     7.       package P2 is
     8.          type Composite (D : Boolean) is record
     9.             case D is
    10.                when False =>
    11.                   Cf : Integer;
    12.                when True =>
    13.                   Ct : T;
    14.             end case;
    15.          end record;
    16.       end P2;
    17.       X : Boolean := P2."=" ((False, 1), (False, 1));
                               |
        >>> error: "=" not declared in "P2"

    18.       Y : Boolean := P2."=" (P2.Composite'(False, 1), (False, 1));
                                                 |
        >>> error: premature usage of incomplete type "Composite" defined at
line 8

    19.    private
    20.       type T is array (1 .. Func_Call) of Integer;
    21.    end P1;
    22.
    23. begin
    24.    null;
    25. end Test39;

The compiler issues a meaningful error message in line 18 but not for line 17.

Reply via email to