This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] ada/35792: Refuse completion of tagged type by task type or protected type
On Apr 23, 2008, at 1:25 PM, Samuel Tardieu wrote:
PING for http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00808.html
Sam,
We've made the following patch to our GNAT sources. Thanks for
pointing out the missing checks here.
Ed
Index: sem_ch3.adb
===================================================================
--- sem_ch3.adb (revision 130244)
+++ sem_ch3.adb (working copy)
@@ -13080,13 +13080,26 @@
if Is_Type (Prev)
and then (Is_Tagged_Type (Prev)
or else Present (Class_Wide_Type (Prev)))
- and then not Nkind_In (N, N_Task_Type_Declaration,
- N_Protected_Type_Declaration)
then
- -- The full declaration is either a tagged record or an
- -- extension otherwise this is an error
+ -- The full declaration is either a tagged type (including
+ -- a synchronized type that implements interfaces) or a
+ -- type extension, otherwise this is an error
- if Nkind (Type_Definition (N)) = N_Record_Definition then
+ if Nkind_In (N, N_Task_Type_Declaration,
+ N_Protected_Type_Declaration)
+ then
+ if No (Interface_List (N))
+ and then not Error_Posted (N)
+ then
+ Error_Msg_NE
+ ("full declaration of } must be a tagged type ",
Id, Prev);
+ end if;
+
+ elsif Nkind (Type_Definition (N)) = N_Record_Definition
then
+
+ -- Indicate that the previous declaration (tagged
incomplete
+ -- or private declaration) requires the same on the
full one.
+
if not Tagged_Present (Type_Definition (N)) then
Error_Msg_NE
("full declaration of } must be tagged", Prev,
Id);