This is the mail archive of the gcc-patches@gcc.gnu.org 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] Error in declaration of overriding operation.


This patch improves the error message generated when an abstract operation
inherited from a progenitor interface is improperly overridden by an operation
of a derived synchronized type.

Compiling test.adb below must produce:

test_aux.ads:6:09: interface subprogram "Test_Function" must be overridden
test_aux.ads:7:26: profile is not type conformant with prefixed view profile
     of inherited operation "Test_Function"
---
with Ada.Text_IO;
with Test_Aux;
procedure Test is
   Obj : constant Test_Aux.Test_Interface_Pointer := new Test_Aux.Test_PO;
begin
   Ada.Text_IO.Put_Line(Boolean'Image(Obj.Test_Function));
end Test;
---
package Test_Aux is

   type Test_Interface is synchronized interface;
   function Test_Function(Param : Test_Interface) return Boolean is abstract;

   protected type Test_PO is new Test_Interface with
      function Test_Function(Param : Test_Interface) return Boolean;
   private
      Var : Boolean := True;
   end Test_PO;

   type Test_Interface_Pointer is access all Test_Interface'Class;
end Test_Aux;

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

2009-04-29  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Check_Abstract_Overriding): Improve error message when
	an abstract operation of a progenitor is not properly overridden by an
	operation of a derived synchronized type.

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]