https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120669
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Eric Botcazou <[email protected]>: https://gcc.gnu.org/g:d4bcf46e0504a688b2c8f5125cf555f63ebeeb98 commit r16-8236-gd4bcf46e0504a688b2c8f5125cf555f63ebeeb98 Author: Eric Botcazou <[email protected]> Date: Fri Mar 20 22:18:54 2026 +0100 Ada: Fix interaction between overloading and types with implicit dereference The overall strategy for types declared with implicit dereference is to add two interpretations for every name, the direct one and the one corresponding to the generalized reference. But the two interpretations are not always preserved through the analysis and, more importantly, the resolution stops at the first couple of interpretations for such a name, disregarding more traditional overloading of specific names. The change makes sure that the two interpretation are preserved through the analysis, and implements the proper resolution of traditionally overloaded names in the presence of types with implicit dereference. It also performs some streamlining in the common processing of overloaded nodes in Resolve. gcc/ada/ PR ada/120669 * sem_ch4.adb (Analyze_Explicit_Dereference): Remove interpretations of the prefix only if they are of access types. (Analyze_One_Call.Indicate_Name_And_Type): Check for an implicit dereference only after indicating the name and type of the call. * sem_ch5.adb (Analyze_Assignment): Do not remove interpretations for the LHS if they are for a type with implicit dereference. * sem_res.adb (Resolve): Streamline the processing of overloaded nodes once an interpretation is picked for them. Add a specific handling for additional interpretations for generalized references. (Resolve_Explicit_Dereference): Remove interpretations of the prefix only if they are of access types. (Is_Ambiguous_Operand): Skip the direct interpretation for a limited type that has implicit dereference. * sem_type.adb (Add_One_Interp): Set the name of the first entry of the table of interpretations in more cases. gcc/testsuite/ * gnat.dg/implicit_deref1.adb: New test. * gnat.dg/implicit_deref2.adb: Likewise. * gnat.dg/implicit_deref3.adb: Likewise.
