aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-02-24 05:41:00 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-08 03:51:15 -0400
commit63408d0eb2f6fd33b6b423396e3d80d54f3235ae (patch)
tree7ca7f3fc5f12ab63c54894b927bee0c4959f7bf5 /gcc
parent072c5071e0e95401cec2b700c3f276c9eb91abb1 (diff)
downloadgcc-63408d0eb2f6fd33b6b423396e3d80d54f3235ae.zip
gcc-63408d0eb2f6fd33b6b423396e3d80d54f3235ae.tar.gz
gcc-63408d0eb2f6fd33b6b423396e3d80d54f3235ae.tar.bz2
[Ada] AI12-0204 Renaming of a prefixed view
2020-06-08 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * sem_ch5.adb: Fix typo. * sem_ch8.adb (Analyze_Renamed_Primitive_Operation): Check that the prefix of a prefixed view must be renamable as an object.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch5.adb2
-rw-r--r--gcc/ada/sem_ch8.adb18
2 files changed, 18 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index e6766c7..0dfd8b4 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -2390,7 +2390,7 @@ package body Sem_Ch5 is
-- AI12-0047 stipulates that the domain (array or container)
-- cannot be a component that depends on a discriminant if the
-- enclosing object is mutable, to prevent a modification of the
- -- dowmain of iteration in the course of an iteration.
+ -- domain of iteration in the course of an iteration.
-- If the object is an expression it has been captured in a
-- temporary, so examine original node.
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 4d9b5ba..79099ef 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -1826,6 +1826,7 @@ package body Sem_Ch8 is
Is_Body : Boolean)
is
Old_S : Entity_Id;
+ Nam : Entity_Id;
function Conforms
(Subp : Entity_Id;
@@ -1902,7 +1903,7 @@ package body Sem_Ch8 is
end if;
if Old_S = Any_Id then
- Error_Msg_N (" no subprogram or entry matches specification", N);
+ Error_Msg_N ("no subprogram or entry matches specification", N);
else
if Is_Body then
@@ -1920,6 +1921,21 @@ package body Sem_Ch8 is
Error_Msg_N ("mode conformance error in renaming", N);
end if;
+ -- AI12-0204: The prefix of a prefixed view that is renamed or
+ -- passed as a formal subprogram must be renamable as an object.
+
+ Nam := Prefix (Name (N));
+
+ if Is_Object_Reference (Nam) then
+ if Is_Dependent_Component_Of_Mutable_Object (Nam) then
+ Error_Msg_N
+ ("illegal renaming of discriminant-dependent component",
+ Nam);
+ end if;
+ else
+ Error_Msg_N ("expect object name in renaming", Nam);
+ end if;
+
-- Enforce the rule given in (RM 6.3.1 (10.1/2)): a prefixed
-- view of a subprogram is intrinsic, because the compiler has
-- to generate a wrapper for any call to it. If the name in a