diff options
author | Javier Miranda <miranda@adacore.com> | 2020-06-16 05:28:54 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-07-27 04:05:17 -0400 |
commit | 36f0cf4e6035406f64158946fff3bef9e2b4059c (patch) | |
tree | 276b6d07e33e5abf5081446196d63ea7e67bda7f /gcc/ada/sem_res.adb | |
parent | 2c3bc159a8ca5f128e934b0357900c40b9d965fb (diff) | |
download | gcc-36f0cf4e6035406f64158946fff3bef9e2b4059c.zip gcc-36f0cf4e6035406f64158946fff3bef9e2b4059c.tar.gz gcc-36f0cf4e6035406f64158946fff3bef9e2b4059c.tar.bz2 |
[Ada] Ada2020: AI12-0027 Access values and unaliased component
gcc/ada/
* sem_res.adb (Resolve_Actuals): Restore restrictive check on
view conversions which required matching value of
Has_Aliased_Components of formals and actuals. Required to avoid
the regression of ACATS b460005.
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r-- | gcc/ada/sem_res.adb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index bf4774c..f1c0177 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -4118,9 +4118,25 @@ package body Sem_Res is if Ekind (F) = E_In_Out_Parameter and then Is_Array_Type (Etype (F)) then + -- In a view conversion, the conversion must be legal in + -- both directions, and thus both component types must be + -- aliased, or neither (4.6 (8)). + + -- The extra rule in 4.6 (24.9.2) seems unduly + -- restrictive: the privacy requirement should not apply + -- to generic types, and should be checked in an + -- instance. ARG query is in order ??? + + if Has_Aliased_Components (Expr_Typ) /= + Has_Aliased_Components (Etype (F)) + then + Error_Msg_N + ("both component types in a view conversion must be" + & " aliased, or neither", A); + -- Comment here??? what set of cases??? - if not Same_Ancestor (Etype (F), Expr_Typ) then + elsif not Same_Ancestor (Etype (F), Expr_Typ) then -- Check view conv between unrelated by ref array -- types. |