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] |
The class-wide type of private extension is created when the partial view is analyzed. This class-wide type is shared with the full view. If the full view is a subtype, as is the case when the parent is a constrained discriminated subtype, the type of the private extension must be the base type of the full view, to prevent spurious semantic errors when the classwide equivalent type is constructed. This expansion involves dispatching calls to Size and to Deep_Adjust, and these are best expressed on the full view. x.adb must compile quietly: --- with P; use P; package X is function Create return access Child_1_3'Class; type Child_Acc is access all Child_1_3'Class; end X; --- package body X is function Create return access Child_1_3'Class is Res : Child_Acc := new Child_1_3; Res2 : Child_Acc := new Child_1_3'Class'(Res.all); begin return Res2; end Create; end X; --- package P is type Root_1 (V : Integer) is tagged record null; end record; type Child_1_3 is new Root_1 (1) with private; private type Child_1_3 is new Root_1 (1) with null record; end P; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-18 Ed Schonberg <schonberg@adacore.com> * exp_util.adb (Make_Subtype_From_Expr): If the unconstrained type is the class-wide type for a private extension, and the completion is a subtype, set the type of the class-wide type to the base type of the full view.
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] |