Patchwork [Ada] Do not skip analysis of aspect X when X'Class aspect present (and reverse)

login
register
mail settings
Submitter Arnaud Charlet
Date Aug. 4, 2011, 9:13 a.m.
Message ID <20110804091358.GA3468@adacore.com>
Download mbox | patch
Permalink /patch/108386/
State New
Headers show

Comments

Arnaud Charlet - Aug. 4, 2011, 9:13 a.m.
Compiling the following code now raises an error:

package P is
   procedure Proc (X : out Boolean)
     with Post'Class => X,
          Post => not X,
          Post => X;
end P;

$ gcc -c -gnat2012 p.ads
p.ads:5:11: aspect "Post" for "Proc" previously given at line 4

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

2011-08-04  Yannick Moy  <moy@adacore.com>

	* sem_ch13.adb (Aspect_Loop): when an aspect X and its classwise
	corresponding aspect X'Class are allowed, proceed with analysis of the
	aspect instead of skipping it.

Patch

Index: sem_ch13.adb
===================================================================
--- sem_ch13.adb	(revision 177340)
+++ sem_ch13.adb	(working copy)
@@ -854,7 +854,7 @@ 
                      end if;
                   end if;
 
-                  goto Continue;
+                  --  Allowed case of X and X'Class both specified
                end if;
 
                Next (Anod);