aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2020-10-27 12:17:37 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-26 03:39:54 -0500
commit4e94b2442d9286cafe47f32579b19a2ea681e132 (patch)
tree2dbec0dbcedd7f10bb7387fa4b64d9588af30c85
parent52424b13d80af31b6004995c1910fb9ee0ab1939 (diff)
downloadgcc-4e94b2442d9286cafe47f32579b19a2ea681e132.zip
gcc-4e94b2442d9286cafe47f32579b19a2ea681e132.tar.gz
gcc-4e94b2442d9286cafe47f32579b19a2ea681e132.tar.bz2
[Ada] Improve error message on illegal prefixed procedure call
gcc/ada/ * sem_ch6.adb (Analyze_Call_And_Resolve): Add information to the error message on an illegal procedure call, when the illegality is due to the presence of a component of the full view of the target object, as well as a procedure with the same name (See RM 4.1.3 (9.2/3)).
-rw-r--r--gcc/ada/sem_ch6.adb21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 416c618..0c403ed 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -2420,6 +2420,27 @@ package body Sem_Ch6 is
else
Error_Msg_N ("invalid procedure or entry call", N);
+
+ -- Specialize the error message in the case where both a
+ -- primitive operation and a record component are visible
+ -- at the same time.
+
+ if Nkind (P) = N_Selected_Component
+ and then Is_Entity_Name (Selector_Name (P))
+ then
+ declare
+ Sel : constant Entity_Id := Entity (Selector_Name (P));
+ begin
+ if Ekind (Sel) = E_Component
+ and then Present (Homonym (Sel))
+ and then Ekind (Homonym (Sel)) = E_Procedure
+ then
+ Error_Msg_NE ("\component & conflicts with"
+ & " homonym procedure (RM 4.1.3 (9.2/3))",
+ Selector_Name (P), Sel);
+ end if;
+ end;
+ end if;
end if;
<<Leave>>