Aggregates used as actuals of formal object parameters are handled specially
by Instantiate_Object in Sem_Ch12 and qualifying them is sufficient to block
this special processing.
gcc/ada/
PR ada/54178
* sem_ch12.adb (Instantiate_Object): Strip qualification to detect
aggregates used as actuals.
gcc/testsuite/
* gnat.dg/aggr32.adb: New test.
* gnat.dg/aggr32_pkg.ads: New helper.
* gnat.dg/aggr32_pkg-child.ads: Likewise.
-- to capture local names that may be hidden if the generic is
-- a child unit.
- if Nkind (Actual) = N_Aggregate then
+ if Nkind (Unqualify (Actual)) = N_Aggregate then
Preanalyze_And_Resolve (Actual, Typ);
end if;
--- /dev/null
+-- { dg-do compile }
+
+with Aggr32_Pkg.Child;
+
+procedure Aggr32 (W, H : Positive) is
+
+ use Aggr32_Pkg;
+
+ package Test_1 is new Child (Frame => (Width => W, Height => H));
+
+ package Test_2 is new Child (Frame => Rec'(Width => W, Height => H));
+
+begin
+ null;
+end;
--- /dev/null
+generic
+
+ Frame : Rec;
+
+package Aggr32_Pkg.Child is
+end Aggr32_Pkg.Child;
--- /dev/null
+package Aggr32_Pkg is
+
+ type Rec is record
+ Width : Positive;
+ Height : Positive;
+ end record;
+
+end Aggr32_Pkg;