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] Better error message for incorrect instantiations


This patch adds the name of entity that is improperly used as the name in a
package or subprogram instantiation.

Compiling generic_test.adb must yield:

    generic_test.adb:30:10: "E" is not the name of a generic package

---
procedure Generic_Test is

   generic
      M : Positive;
   package G is
      type S is private;
   private
      type S is new Integer;
   end G;

   generic
      with package B is
        new G (<>);
   function E
     (L : B.S) return Boolean;

   function E
     (L : B.S) return Boolean is
   begin

      return True;

   end E;

   package B_6 is
     new G (6);

   -- function B_6_E is
   package B_6_E is -- Gives "expect name of generic package in instantiation"
     new E (B_6);

begin
   null;
end Generic_Test;

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

2013-10-10  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Analyze_Package_Instantiation,
	Analyze_Subprogram_Instantiation): Improve error message when
	name in instantiation does not designate a generic unit of the
	right kind.

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]