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 handles properly additional constructs of the form F.all (I), where F is an access_to_function that can be called without parameters, and that returns an array type. Compiling err.adb must yield: err.adb:23:09: too many arguments in call to "A" err.adb:24:09: too many arguments in call --- procedure Err is function F return String is begin return "ABCD"; end F; type Acc_F is access function return String; function A return Acc_F Is begin return F'Access; end A; function AA (I : Integer) return Acc_F Is begin return F'Access; end AA; B : Integer := 1; C : Character; begin C := A (B); -- (1) too many arguments in call C := AA(1) (B); -- (3) too many arguments in call end Err; --- Executing essai.adb must yield: 'A' 'B' 'C' --- with Text_IO; use Text_IO; procedure Essai is function F return String is begin return "ABCD"; end F; type Acc_F is access function return String; function A return Acc_F Is begin return F'Access; end A; function AA (I : Integer) return Acc_F Is begin return F'Access; end AA; B : Integer := 1; C : Character; begin C := A.all (B); Put_Line (Character'image (C)); B := B+1; C := AA(1).all (B); Put_Line (Character'image (C)); B := B+1; C := F(B); Put_Line (Character'image (C)); B := B+1; end Essai; Tested on x86_64-pc-linux-gnu, committed on trunk 2013-09-10 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Access_Subprogram_Declaration): Check whether the designated type can appear in a parameterless call. * sem_ch4.adb (Analyze_Call): Do not insert an explicit dereference in the case of an indirect call through an access function that returns an array type. (Analyze_One_Call): Handle properly legal parameterless calls whose result is indexed, in constructs of the for F.all (I) * sem_ch6.ads (May_Need_Actuals): Make public, for use on access to subprogram types. * sem_res.adb (Resolve_Call): If the call is indirect, there is no entity to set on the name in the call.
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] |