diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-10-20 17:22:07 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-11-21 10:57:40 +0100 |
commit | 50e0095904e0c66b24c205a7d776e6366bc9c7c0 (patch) | |
tree | 310dd2fcf4afe8b60961aac3911cd0420e43e110 /gcc/ada/sem_res.adb | |
parent | c6cd629ffbf895542dcf6e603ab112818cd9afd7 (diff) | |
download | gcc-50e0095904e0c66b24c205a7d776e6366bc9c7c0.zip gcc-50e0095904e0c66b24c205a7d776e6366bc9c7c0.tar.gz gcc-50e0095904e0c66b24c205a7d776e6366bc9c7c0.tar.bz2 |
ada: Fix spurious error on call with default parameter in generic package
This occurs when the default value is a function call returning a private
type, and is caused by a bad interaction between two internal mechanisms.
gcc/ada/
* sem_ch12.adb (Save_Global_References.Set_Global_Type): Beef up
comment about the setting of the full view.
* sem_res.adb (Resolve_Actuals.Insert_Default): Add another bypass
for the case of a generic context.
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r-- | gcc/ada/sem_res.adb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 42f7c10..70a8417 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -4017,13 +4017,21 @@ package body Sem_Res is Analyze_And_Resolve (Actval, Base_Type (Etype (Actval))); -- Resolve entities with their own type, which may differ from - -- the type of a reference in a generic context (the view - -- swapping mechanism did not anticipate the re-analysis of - -- default values in calls). + -- the type of a reference in a generic context because of the + -- trick used in Save_Global_References.Set_Global_Type to set + -- full views forcefully, which did not anticipate the need to + -- re-analyze default values in calls. elsif Is_Entity_Name (Actval) then Analyze_And_Resolve (Actval, Etype (Entity (Actval))); + -- Ditto for calls whose name is an entity, for the same reason + + elsif Nkind (Actval) = N_Function_Call + and then Is_Entity_Name (Name (Actval)) + then + Analyze_And_Resolve (Actval, Etype (Entity (Name (Actval)))); + else Analyze_And_Resolve (Actval, Etype (Actval)); end if; |