]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] AI12-0170: Abstract subprogram calls in class-wide precond exprs
authorGary Dismukes <dismukes@adacore.com>
Sun, 5 Jul 2020 17:29:02 +0000 (13:29 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 19 Oct 2020 09:53:35 +0000 (05:53 -0400)
gcc/ada/

* sem_disp.adb (Check_Dispatching_Context): When the enclosing
subprogram is abstract, bypass early return if the call is
tag-indeterminate, to continue with the later error checking.

gcc/ada/sem_disp.adb

index 67a8cdf6095db43fbaacc03d369d49ae5b6fdf14..cf54337631d863a32776864db7447b3bf0927d55 100644 (file)
@@ -575,12 +575,16 @@ package body Sem_Disp is
             --  Similarly, if this is a pre/postcondition for an abstract
             --  subprogram, it may call another abstract function which is
             --  a primitive of an abstract type. The call is non-dispatching
-            --  but will be legal in overridings of the operation.
+            --  but will be legal in overridings of the operation. However,
+            --  if the call is tag-indeterminate we want to continue with
+            --  with the error checking below, as this case is illegal even
+            --  for abstract subprograms (see AI12-0170).
 
             elsif (Is_Subprogram (Scop)
                     or else Chars (Scop) = Name_Postcondition)
               and then
-                (Is_Abstract_Subprogram (Scop)
+                ((Is_Abstract_Subprogram (Scop)
+                   and then not Is_Tag_Indeterminate (N))
                   or else
                     (Nkind (Parent (Scop)) = N_Procedure_Specification
                       and then Null_Present (Parent (Scop))))