diff options
author | Ed Schonberg <schonberg@adacore.com> | 2020-12-07 19:34:01 -0500 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-04-28 05:38:05 -0400 |
commit | bb60efc5c75afa2c409c740b970f5f1e6fdd4890 (patch) | |
tree | 81b3a6df324569bef4c09a19b7dafe8707c313fe | |
parent | ff683f9f0341391253eef171890f1b98f18ec99d (diff) | |
download | gcc-bb60efc5c75afa2c409c740b970f5f1e6fdd4890.zip gcc-bb60efc5c75afa2c409c740b970f5f1e6fdd4890.tar.gz gcc-bb60efc5c75afa2c409c740b970f5f1e6fdd4890.tar.bz2 |
[Ada] Crash on inherited component in type extension in generic unit.
gcc/ada/
* exp_ch3.adb (Expand_Record_Extension): Set Parent_Subtype on
the type extension when within a generic unit, even though
expansion is disabled, to allow for proper resolution of
selected components inherited from an ancestor.
-rw-r--r-- | gcc/ada/exp_ch3.adb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index b916aef..56924a0 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7782,9 +7782,14 @@ package body Exp_Ch3 is -- Expand_Record_Extension is called directly from the semantics, so -- we must check to see whether expansion is active before proceeding, -- because this affects the visibility of selected components in bodies - -- of instances. + -- of instances. Within a generic we still need to set Parent_Subtype + -- link because the visibility of inherited components will have to be + -- verified in subsequent instances. if not Expander_Active then + if Inside_A_Generic and then Ekind (T) = E_Record_Type then + Set_Parent_Subtype (T, Etype (T)); + end if; return; end if; |