Commit e3a79ce3 by Justin Squirek Committed by Pierre-Marie de Rodat

[Ada] Spurious error on incomplete tagged formal parameter

This patch fixes an issue whereby a check for competing controlling
formals led to a spurious dispatching error due to an incomplete type
being used within a subprogram specification.

2019-07-04  Justin Squirek  <squirek@adacore.com>

gcc/ada/

	* sem_disp.adb (Check_Controlling_Formals): Obtain the full view
	before type comparison.

gcc/testsuite/

	* gnat.dg/tagged2.adb, gnat.dg/tagged2.ads: New testcase.

From-SVN: r273063
parent bdbb2a40
2019-07-04 Justin Squirek <squirek@adacore.com>
* sem_disp.adb (Check_Controlling_Formals): Obtain the full view
before type comparison.
2019-07-04 Ed Schonberg <schonberg@adacore.com>
* exp_ch4.ads, exp_ch4.adb (Build_Eq_Call): New visible
......
......@@ -210,6 +210,14 @@ package body Sem_Disp is
Ctrl_Type := Check_Controlling_Type (Etype (Formal), Subp);
if Present (Ctrl_Type) then
-- Obtain the full type in case we are looking at an incomplete
-- view.
if Ekind (Ctrl_Type) = E_Incomplete_Type
and then Present (Full_View (Ctrl_Type))
then
Ctrl_Type := Full_View (Ctrl_Type);
end if;
-- When controlling type is concurrent and declared within a
-- generic or inside an instance use corresponding record type.
......
2019-07-04 Justin Squirek <squirek@adacore.com>
* gnat.dg/tagged2.adb, gnat.dg/tagged2.ads: New testcase.
2019-07-04 Ed Schonberg <schonberg@adacore.com>
* gnat.dg/equal6.adb, gnat.dg/equal6_types.adb,
......
-- { dg-do compile }
package body Tagged2 is
procedure Get_Parent
(DeviceX : Device;
Parent : out Device) is null;
end Tagged2;
package Tagged2 is
type Device;
procedure Get_Parent
(DeviceX : Device;
Parent : out Device);
type Device is tagged null record;
end Tagged2;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment