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] Missing error on conflicting declarations


With This patch the compiler properly rejects a subprogram body whose
signature is type conformant with a previous expression function in
the same scope.

Compiling same_signature,adb must yield:

  same_signature.adb:8:04: body conflicts with expression function at line 5

---
with Ada.Text_IO; use Ada.Text_IO;

procedure Same_Signature is

   function My_Add (A, B : Integer) return Integer
   is (A - B);

   function My_Add (A, B : Integer) return Integer is
   begin
      return A + B;
   end My_Add;

begin
   Put_Line (My_Add (5, 6)'Img);
end Same_Signature;

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

2015-10-26  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Find_Corresponding_Spec): Reject a subprogram
	body whose signature is type conformant with a previous expression
	function.

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]