[COMMITTED] ada: Default_Component_Value trumps Initialize/Normalize_Scalars
Checks
Commit Message
From: Steve Baird <baird@adacore.com>
If the Default_Component_Value aspect is specified for an array type, then
specifying Initialize_Scalars or Normalize_Scalars should have no effect
on the default initialization of an object of the array type.
gcc/ada/
* exp_ch3.adb
(Expand_N_Object_Declaration.Default_Initialize_Object): Add test for
specified Default_Component_Value aspect when deciding whether
either Initialize_Scalars or Normalize_Scalars impacts default
initialization of an array object.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_ch3.adb | 6 ++++++
1 file changed, 6 insertions(+)
@@ -6897,6 +6897,12 @@ package body Exp_Ch3 is
and then not Has_Predicates (Component_Type (Typ))
+ -- Array default component value takes precedence over
+ -- Init_Or_Norm_Scalars.
+
+ and then No (Find_Aspect (Typ,
+ Aspect_Default_Component_Value))
+
-- The component type must have a single initialization value
and then Simple_Initialization_OK (Component_Type (Typ))