re PR ada/29015 (Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error)

gcc/ada/
	PR ada/29015
	* sem_ch12.adb (Instantiate_Type): Check whether the full view of
	the type is known instead of the underlying type.

    gcc/testsuite/
	PR ada/29015
	* gnat.dg/incomplete1.ads, gnat.dg/incomplete2.ads,
	gnat.dg/incomplete2.adb: New.

From-SVN: r134345
This commit is contained in:
Samuel Tardieu 2008-04-16 12:37:38 +00:00 committed by Samuel Tardieu
parent 78347d7233
commit 35c91e0571
6 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2008-04-16 Samuel Tardieu <sam@rfc1149.net>
PR ada/29015
* sem_ch12.adb (Instantiate_Type): Check whether the full view of
the type is known instead of the underlying type.
2008-04-15 Ed Schonberg <schonberg@adacore.com>
PR ada/22387

View File

@ -9990,7 +9990,7 @@ package body Sem_Ch12 is
Ekind (Root_Type (Act_T)) = E_Incomplete_Type)
then
if Is_Class_Wide_Type (Act_T)
or else No (Underlying_Type (Act_T))
or else No (Full_View (Act_T))
then
Error_Msg_N ("premature use of incomplete type", Actual);
Abandon_Instantiation (Actual);

View File

@ -1,3 +1,9 @@
2008-04-16 Samuel Tardieu <sam@rfc1149.net>
PR ada/29015
* gnat.dg/incomplete1.ads, gnat.dg/incomplete2.ads,
gnat.dg/incomplete2.adb: New.
2008-04-16 Hans-Peter Nilsson <hp@axis.com>
PR tree-optimization/35629

View File

@ -0,0 +1,3 @@
package Incomplete1 is
type T is null record;
end Incomplete1;

View File

@ -0,0 +1,4 @@
-- { dg-do compile }
-- { dg-excess-errors "instantiation abandoned" }
with Incomplete1;
package body Incomplete2 is end Incomplete2;

View File

@ -0,0 +1,8 @@
limited with Incomplete1;
package Incomplete2 is
pragma Elaborate_Body;
generic
type T is private;
package G is end G;
package I1 is new G (Incomplete1.T); -- { dg-error "premature use" }
end Incomplete2;