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] Abstrct null extensions


AI05-0097 fixes a gap in the RM, that allowed an abstract null extension to
inherit a concrete constructor.
The following must be rejected in any Ada mode:

---
package P is
    type Generator is tagged record
       Value : Integer := 17;
    end record;

    function Create return Generator;
 end P;
---
 with P;
 package Q is
     type Windmill is abstract new P.Generator with null record;
     -- Inherits a concrete Create here(!!)
 end Q;
---
 with P, Q;
 procedure Main is
     Obj : P.Generator'Class := Q.Create;
 begin
   null;
 end;

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

2010-10-08  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Derive_Subprogram): If an abstract extension has a
	concrete parent with a concrete constructor, the inherited constructor
	is abstract even if the derived type is a null extension.

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]