Eric Botcazou d4bcf46e05 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.
2026-03-20 22:27:51 +01:00
2026-03-15 00:16:26 +00:00
2026-03-20 00:16:27 +00:00
2026-03-16 00:16:25 +00:00
2026-03-14 19:31:10 +01:00
2026-02-27 00:16:38 +00:00
2026-03-14 19:31:10 +01:00
2026-03-19 00:16:27 +00:00
2026-03-06 00:16:27 +00:00
2026-03-13 00:16:40 +00:00
2026-03-18 00:16:29 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%