aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2022-04-02 17:29:09 +0000
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-18 08:41:04 +0000
commit5b0e8d6937f7857e3dc7486a989e0c72d478c1ed (patch)
tree5d2e8c571c07343ed095719f6f006f1df30177ed /gcc/ada/sem_ch6.adb
parent9af8c27f090ae549f43e40cff00a9d702db0ac85 (diff)
[Ada] Errors missed on ACATS test B650007
This ACATS test shows that we need to call Is_Immutably_Limited_Type in Analyze_Function_Return and also that we have a latent bug in Is_Immutably_Limited_Type which shouldn't look through private types. gcc/ada/ * sem_aux.adb (Is_Immutably_Limited_Type): Do not look through private types as per RM 7.5(8.1). * sem_ch6.adb (Analyze_Function_Return): Use Is_Immutably_Limited_Type as per RM 6.5(5.10).
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 2939394d88d..c9e57e95b10 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -1566,17 +1566,18 @@ package body Sem_Ch6 is
-- Check RM 6.5 (5.9/3)
- if Has_Aliased then
+ if Has_Aliased and then not Is_Immutably_Limited_Type (R_Type) then
if Ada_Version < Ada_2012
and then Warn_On_Ada_2012_Compatibility
then
Error_Msg_N
- ("ALIASED only allowed for limited return objects "
- & "in Ada 2012?y?", N);
+ ("ALIASED only allowed for immutably limited return " &
+ "objects in Ada 2012?y?", N);
- elsif not Is_Limited_View (R_Type) then
+ else
Error_Msg_N
- ("ALIASED only allowed for limited return objects", N);
+ ("ALIASED only allowed for immutably limited return " &
+ "objects", N);
end if;
end if;