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] |
AI05-288 specifies that subtype conformance is required for actual types for generic formal access-to-subprogram types, rather than just mode conformance. This is a binding interpretation. Compiling pack2.adb must yield: pack2.adb:4:37: not subtype conformant with declaration at pack1.ads:2 pack2.adb:4:37: type of "N" does not match generic type ACC is access procedure (N : Natural); package Pack1 is procedure Test1 (A : out ACC); end Pack1; --- package body Pack1 is procedure Test1 (A : out ACC) is begin null; end Test1; end Pack1; --- package Pack2 is procedure Cause_A_Problem; end Pack2; --- with Pack1; package body Pack2 is type Actual_Acc is access procedure (N : Integer); package New_Pack1 is new Pack1 (Actual_Acc); procedure Cause_A_Problem is X : Actual_Acc; begin New_Pack1.Test1 (X); X (-1); -- PROBLEM end Cause_A_Problem; end Pack2; --- Tested on x86_64-pc-linux-gnu, committed on trunk 2012-03-15 Ed Schonberg <schonberg@adacore.com> * sem_ch6.ads, sem_ch6.adb (Check_Subtype_Conformant): add Get_Inst formal, so that conformance within an instantiation follows renamings of formals. This is similar to what is already done in Check_Mode_conformant. * sem_ch12.adb (Vailidate_Access_Subprogram_Instance): check that formal and actual are subtype conformant. Previously only mode conformance was required.
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] |