]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Do not call Set_Cloned_Subtype on private type
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 2 Mar 2021 00:04:10 +0000 (01:04 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Tue, 2 Mar 2021 00:05:38 +0000 (01:05 +0100)
Build_Discriminated_Subtype may be invoked on a E_Record_Type_With_Private,
in which case it builds a E_Record_Subtype_With_Private which does not have
the Cloned_Subtype field.

gcc/ada/
PR ada/99020
* sem_ch3.adb (Build_Discriminated_Subtype): Set the Cloned_Subtype
only if the type is not private.

gcc/ada/sem_ch3.adb

index c01bce132c07f7a4df8034f4fb7b965362648508..4c7b8e7659b6a1b9128c09dcb767b06101e2e86a 100644 (file)
@@ -10493,7 +10493,7 @@ package body Sem_Ch3 is
          then
             Create_Constrained_Components (Def_Id, Related_Nod, T, Elist);
 
-         else
+         elsif not Is_Private_Type (T) then
             Set_Cloned_Subtype (Def_Id, T);
          end if;
       end if;