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] |
This patch adds a missing case to the accessibility mechanism. The machinery can now recognize a rewritten interface conversion and properly extract the level of the operand. ------------ -- Source -- ------------ -- types.ads package Types is type Iface is limited interface; type Any_Iface_Ptr is access all Iface'Class; type Port_Type is tagged record Data : Any_Iface_Ptr; end record; procedure Connect (Port : in out Port_Type; Data : Any_Iface_Ptr); type Computer_Type is limited new Iface with record Port : Port_Type; end record; procedure Init_Ports (Comp : in out Computer_Type); end Types; -- types.adb package body Types is procedure Connect (Port : in out Port_Type; Data : Any_Iface_Ptr) is begin Port.Data := Data; end Connect; procedure Init_Ports (Comp : in out Computer_Type) is begin Comp.Port.Connect (Iface (Comp)'Access); end Init_Ports; end Types; ---------------------------- -- Compilation and output -- ---------------------------- $ gcc -c -gnat05 types.adb types.adb:9:26: non-local pointer cannot point to local object Tested on x86_64-pc-linux-gnu, committed on trunk 2013-02-06 Hristian Kirtchev <kirtchev@adacore.com> * sem_util.adb (Is_Interface_Conversion): New routine. (Object_Access_Level): Detect an interface conversion that has been rewritten into a different construct. Use the original form of the conversion to find the access level of the operand.
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] |