When the SPARK restriction was set, GNAT was not issuing violations on generic.
Now corrected.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-04  Marc Sango  <sa...@adacore.com>

        * sem_ch12.adb (Analyze_Generic_Package_Declaration,
        Analyze_Generic_Subprogram_Declaration, Analyze_Package_Instantiation,
        Analyze_Subprogram_Instantiation): Check absence of generic in SPARK
        mode.

Index: sem_ch12.adb
===================================================================
--- sem_ch12.adb        (revision 177384)
+++ sem_ch12.adb        (working copy)
@@ -2690,6 +2690,8 @@
       Decl        : Node_Id;
 
    begin
+      Check_SPARK_Restriction ("generic is not allowed", N);
+
       --  We introduce a renaming of the enclosing package, to have a usable
       --  entity as the prefix of an expanded name for a local entity of the
       --  form Par.P.Q, where P is the generic package. This is because a local
@@ -2811,6 +2813,8 @@
       Typ         : Entity_Id;
 
    begin
+      Check_SPARK_Restriction ("generic is not allowed", N);
+
       --  Create copy of generic unit, and save for instantiation. If the unit
       --  is a child unit, do not copy the specifications for the parent, which
       --  are not part of the generic tree.
@@ -3051,6 +3055,8 @@
    --  Start of processing for Analyze_Package_Instantiation
 
    begin
+      Check_SPARK_Restriction ("generic is not allowed", N);
+
       --  Very first thing: apply the special kludge for Text_IO processing
       --  in case we are instantiating one of the children of [Wide_]Text_IO.
 
@@ -4195,6 +4201,8 @@
    --  Start of processing for Analyze_Subprogram_Instantiation
 
    begin
+      Check_SPARK_Restriction ("generic is not allowed", N);
+
       --  Very first thing: apply the special kludge for Text_IO processing
       --  in case we are instantiating one of the children of [Wide_]Text_IO.
       --  Of course such an instantiation is bogus (these are packages, not

Reply via email to