diff options
author | Steve Baird <baird@adacore.com> | 2023-03-30 13:22:01 -0700 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-29 10:23:19 +0200 |
commit | 603c253d2698a586f5fa55acd25deb2bc8bd6e4f (patch) | |
tree | 0c6f1346b2a59bb3650ec9e2ee51ca9e2a7e0055 | |
parent | 265c571daa41fdf4d21e06c55703f65ec9aad8c4 (diff) | |
download | gcc-603c253d2698a586f5fa55acd25deb2bc8bd6e4f.zip gcc-603c253d2698a586f5fa55acd25deb2bc8bd6e4f.tar.gz gcc-603c253d2698a586f5fa55acd25deb2bc8bd6e4f.tar.bz2 |
ada: Default_Component_Value trumps Initialize/Normalize_Scalars
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.
-rw-r--r-- | gcc/ada/exp_ch3.adb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index e23a3fd..5f651ba 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -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)) |