This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] missing error on interface overriding

If an inherited subprogram is implemented by a protected function,
then the first parameter of the inherited subprogram shall be of
mode in, but not an access-to-variable parameter (RM 9.4(11/9)

After this patch the error is reported in the following example:

procedure by30015_01p is

   package pack is
      type Iface is protected interface;
      function Prim1_1
        (M : in out Iface; Value : Integer) return Natural is abstract;

      protected type PO_T1 is new Iface with
         function Prim1_1 (Value : Integer) return Natural; -- ERROR
      end PO_T1;
   end pack;

   package body Pack is  
      protected body PO_T1 is
         function Prim1_1 (Value : Integer) return Natural is
         begin return 0; end;
      end PO_T1;
   end Pack;


Command: gcc -c -gnat12 by30015_01p.adb
by30015_01p.adb:9:19: illegal overriding of subprogram inherited from
by30015_01p.adb:9:19: first formal of "Prim1_1" declared at line 5 must
 be of mode "in" or access-to-constant

Tested on x86_64-pc-linux-gnu, committed on trunk

2015-02-05  Javier Miranda  <>

	* errout.adb (Error_Msg_PT): Add missing error.
	* sem_ch6.adb (Check_Synchronized_Overriding): Check the missing
	RM rule.  Code cleanup.
	* exp_ch9.adb (Build_Wrapper_Spec): Propagate "constant" in
	anonymous access types.  Found working on the tests. Code cleanup.

Attachment: difs
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]