diff options
| author | Javier Miranda <miranda@adacore.com> | 2025-11-11 19:00:22 +0000 |
|---|---|---|
| committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2025-11-21 09:29:37 +0100 |
| commit | f656344f5fad97f67bd12797a37bb5922021fd5c (patch) | |
| tree | 9db8df934373b9697997f57298fe7af489f200c7 | |
| parent | 0c8271742f32fcf08f0b5818aaad2daafff89b62 (diff) | |
ada: No extra formals on anonymous access types of C subprograms
Extra formals must not be added to anonymous access to subprogram
types defined in the profile of imported C subprograms.
gcc/ada/ChangeLog:
* sem_ch6.adb (Create_Extra_Formals): Do not add extra formals to
anonymous access to subprogram types defined in the profile of
subprograms that have foreign convention.
| -rw-r--r-- | gcc/ada/sem_ch6.adb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 0629dda91a9..1235ea453b6 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -9077,6 +9077,17 @@ package body Sem_Ch6 is then Freeze_Extra_Formals (E); return; + + elsif Ekind (Ref_E) in E_Subprogram_Type + and then Is_Itype (Ref_E) + and then Nkind (Associated_Node_For_Itype (Ref_E)) in + N_Function_Specification + | N_Procedure_Specification + and then Has_Foreign_Convention + (Defining_Entity (Associated_Node_For_Itype (Ref_E))) + then + Freeze_Extra_Formals (E); + return; end if; -- If the subprogram is a predefined dispatching subprogram then don't |
