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

            Bug ID: 120110
           Summary: Instantiation error record aggregate must use (), not
                    []
           Product: gcc
           Version: 14.2.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 61308
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61308&action=edit
Reproducer test_20250501_genagg.zip

My instantiation of a generic package with a body including a container
aggregate using [...] provoques a weird error:

% gcc -c -gnat2022 -gnatv test_20250501_genagg.adb  
GNAT 14.2.0
Copyright 1992-2024, Free Software Foundation, Inc.
Compiling: test_20250501_genagg.adb
Source file time stamp: 2025-05-05 07:36:53
Compiled at: 2025-05-05 09:38:57
     7.    package NP is new Test_20250501_genagg_P (H);
           |
        >>> error: instantiation error at test_20250501_genagg_p.adb:10
        >>> error: record aggregate must use (), not []

Whereas compilation of generic package is ok:
% gcc -c -gnat2022 -gnatl test_20250501_genagg_p.adb
GNAT 14.2.0
Copyright 1992-2024, Free Software Foundation, Inc.
Compiling: test_20250501_genagg_p.adb
Source file time stamp: 2025-05-05 07:36:07
Compiled at: 2025-05-05 09:41:10
     1. with ada.Containers.Vectors;
     2. with ada.Strings.Wide_Wide_Unbounded;
     3. with Test_20250501_genagg_b;
     4. package body Test_20250501_genagg_P is
     5.    procedure Agg (S : Wide_Wide_String) is
     6.       use type
ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String;
     7.       A : Test_20250501_genagg_b.My_C.Vector;
     8.    begin
     9.       A.append ("3.14");
    10.       A := ["2.0" , Test_20250501_genagg_b.get_r("5.0" & S), "3.0"];
    11.    end Agg;
    12. end Test_20250501_genagg_P;
Compiling: test_20250501_genagg_p.ads
Source file time stamp: 2025-05-05 07:36:07
Compiled at: 2025-05-05 09:41:10
     1. with Test_20250501_genagg_b;
     2. generic
     3.       type E is new Test_20250501_genagg_b.K.Object with private;
     4. package Test_20250501_genagg_P is
     5.
     6.    procedure Agg(S : Wide_Wide_String) ;
     7.
     8. end;
 12 lines: No errors

The error is misleading.
In attachement the complete source codes.

Reply via email to