Resolve_Container_Aggregate (N, Typ);
+ -- Check for an attempt to use "[]" for an aggregate of a record type
+ -- after handling the case where the type has an Aggregate aspect,
+ -- because the aspect can be specified for record types, but if it
+ -- wasn't specified, then this is an error.
+
+ elsif Is_Record_Type (Typ) and then Is_Homogeneous_Aggregate (N) then
+ Error_Msg_N ("record aggregate must use (), not '[']", N);
+
elsif Is_Array_Type (Typ) then
-- First a special test, for the case of a positional aggregate of
return;
end if;
- -- A record aggregate can only use parentheses
-
- if Nkind (N) = N_Aggregate
- and then Is_Homogeneous_Aggregate (N)
- then
- Error_Msg_N ("record aggregate must use (), not '[']", N);
- return;
- end if;
-
-- STEP 2: Verify aggregate structure
Step_2 : declare