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] Additional information on subtype conformance error


This patch adds a clarifying message info when subtype conformance fails, due
to a missing null exclusion indicatar in a formal that must  match a controlling
access formal. This Ada 2005 rule was checked partially in the context of
subprogram renamings but not for 'Access attribute references.

Compiling alpha.adb in gnat05 mode must be rejected with:

    alpha.adb:6:19: not subtype conformant with declaration at beta.ads:3
    alpha.adb:6:19: controlling formal "Ref" of "Updated" excludes null,
    declaration must exclude null as well

---
  with Beta;
  package Alpha is
     type Object is tagged limited null record;

     procedure Start;

     procedure Updated (Ref : access Object) is null;
  end Alpha;
---

  package body Alpha is

     procedure Start is
     begin
        Beta.Set (Updated'Access);
     end Start;
  end Alpha;
---
  limited with Alpha;
  package Beta is
     type Callback is access procedure (Ref : access Alpha.Object);

     procedure Set (Proc : in Callback) is null;
  end Beta;

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

2012-10-03  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Check_Conformance): Additional info when subtype
	conformance fails, due to a missing null exclusion indicatar in
	a formal that must match a controlling access formal.

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]