diff options
Diffstat (limited to 'gcc/ada/sem_ch13.adb')
-rw-r--r-- | gcc/ada/sem_ch13.adb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 10f4a74..709dabe 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10706,10 +10706,11 @@ package body Sem_Ch13 is Set_Has_Inheritable_Invariants (Typ); end if; - -- If the full view of the type is a scalar type or array type, the - -- implicit base type created for it has the same invariant. + -- If we have a subtype with invariants, whose base type does not have + -- invariants, copy these invariants to the base type. This happens for + -- the case of implicit base types created for scalar and array types. - elsif Has_Invariants (Typ) and then Base_Type (Typ) /= Typ + elsif Has_Invariants (Typ) and then not Has_Invariants (Base_Type (Typ)) then Set_Has_Invariants (Base_Type (Typ)); |