From 251b6a477e97787533753da196dc6e9640359a5a Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Fri, 16 Oct 2015 10:28:37 +0000 Subject: [PATCH] sem_util.adb (Gather_Components): When gathering components of a nested variant... 2015-10-16 Ed Schonberg * sem_util.adb (Gather_Components): When gathering components of a nested variant, the record type used in legality checks is the enclosing record type. From-SVN: r228865 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/sem_util.adb | 13 +++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9effe45f230..e31645e00ad 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2015-10-16 Ed Schonberg + + * sem_util.adb (Gather_Components): When gathering components + of a nested variant, the record type used in legality checks is + the enclosing record type. + 2015-10-13 Jakub Jelinek * gcc-interface/utils.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10, diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index a29b286f717..56f4d9378ca 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -7292,10 +7292,11 @@ package body Sem_Util is end if; -- If we have found the corresponding choice, recursively add its - -- components to the Into list. + -- components to the Into list. The nested components are part of + -- the same record type. Gather_Components - (Empty, Component_List (Variant), Governed_By, Into, Report_Errors); + (Typ, Component_List (Variant), Governed_By, Into, Report_Errors); end Gather_Components; ------------------------ @@ -16998,7 +16999,7 @@ package body Sem_Util is begin -- This is a private type which is not completed yet. This can only -- happen in a default expression (of a formal parameter or of a - -- record component). Do not expand transient scope in this case + -- record component). Do not expand transient scope in this case. if No (Typ) then return False; @@ -17104,9 +17105,9 @@ package body Sem_Util is -- nondiscriminants). That is, the recursive calls are too conservative. function Has_Discrim_Dep_Array (Typ : Entity_Id) return Boolean; - -- True if we find certain discriminant-dependent array - -- subcomponents. This shouldn't be necessary, but without this check, - -- we crash in gimplify. ??? + -- True if we find certain discriminant-dependent array subcomponents. + -- This shouldn't be necessary, but without this check, we crash in + -- gimplify. ??? function Caller_Known_Size_Record (Typ : Entity_Id) return Boolean is pragma Assert (Typ = Underlying_Type (Typ)); -- 2.30.2