[Ada] Better error message on illegal 'Access on formal subprogram
This patch improves on the error message for an attempt to apply 'Access
to a formal subprogram. It also applies the check to a renaming of a formal
subprogram.
Compiling p.adb must yield:
p.adb:15:18: not subtype conformant with declaration at line 2
p.adb:15:18: formal subprograms are not subtype conformant (RM 6.3.1 (17/3))
p.adb:16:18: not subtype conformant with declaration at line 2
p.adb:16:18: formal subprograms are not subtype conformant (RM 6.3.1 (17/3))
----
package body P is
procedure Non_Generic (P : access procedure (I : Integer)) is
begin
P.all (5);
end Non_Generic;
procedure G is
procedure Local (I : Integer) is
begin
Action (I);
end;
procedure Local_Action (I : Integer) renames Action;
begin
Non_Generic (Local'access);
Non_Generic (Local_Action'access);
Non_Generic (Action'access);
-- p.adb:15:18: not subtype conformant with declaration at line 2
-- p.adb:15:18: formal subprograms not allowed
end G;
end P;
----
package P is
generic
with procedure Action (I : Integer);
procedure G;
end P;
2018-05-22 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch6.adb (Check_Conformance): Add RM reference for rule that a
formal subprogram is never subtype conformqnt, and thus cannot be the
prefix of 'Access. Reject as well the attribute when applied to a
renaming of a formal subprogram.
From-SVN: r260527