aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2020-02-09 19:30:05 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-08 03:50:53 -0400
commit2f7294f23e87c4e0a48e50814ab7bb9a4a756a9f (patch)
tree683b4dc1ab0ef4073de87628ba97e5659266bdec /gcc
parent8472d81ea00dc16a55b55a21ed34499390604941 (diff)
downloadgcc-2f7294f23e87c4e0a48e50814ab7bb9a4a756a9f.zip
gcc-2f7294f23e87c4e0a48e50814ab7bb9a4a756a9f.tar.gz
gcc-2f7294f23e87c4e0a48e50814ab7bb9a4a756a9f.tar.bz2
[Ada] Ada_2020: shared variable control aspects on formal derived types
2020-06-08 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * par-ch12.adb (P_Formal_Derived_Type_Definition): Handle properly formal derived types that include aspect specifications, so that the "with" keyword appears twice in the formal type declaration. * sem_ch13.adb (Has_Generic_Parent): Return true if the type itself is a generic formal.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/par-ch12.adb8
-rw-r--r--gcc/ada/sem_ch13.adb6
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb
index ebfe791..c53f7cb 100644
--- a/gcc/ada/par-ch12.adb
+++ b/gcc/ada/par-ch12.adb
@@ -972,8 +972,14 @@ package body Ch12 is
if Token = Tok_With then
- if Ada_Version >= Ada_2020 and Token /= Tok_Private then
+ if Ada_Version >= Ada_2020 and not Next_Token_Is (Tok_Private) then
+
-- Formal type has aspect specifications, parsed later.
+ -- Otherwise this is a formal derived type. Note that it may
+ -- also include later aspect specifications, as in:
+
+ -- type DT is new T with private with atomic;
+
return Def_Node;
else
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index bd3010c..b0b673f 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -13027,7 +13027,7 @@ package body Sem_Ch13 is
function Rep_Item_Too_Early (T : Entity_Id; N : Node_Id) return Boolean is
function Has_Generic_Parent (E : Entity_Id) return Boolean;
- -- Return True if any ancestor is a generic type
+ -- Return True if R or any ancestor is a generic type
------------------------
-- Has_Generic_Parent --
@@ -13037,6 +13037,10 @@ package body Sem_Ch13 is
Ancestor_Type : Entity_Id := Etype (E);
begin
+ if Is_Generic_Type (E) then
+ return True;
+ end if;
+
while Present (Ancestor_Type)
and then not Is_Generic_Type (Ancestor_Type)
and then Etype (Ancestor_Type) /= Ancestor_Type