aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2020-07-05 13:29:02 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-19 05:53:35 -0400
commitc95f21001dc9b7dbe717ef84924220192c7b48ae (patch)
tree552d7eeddfbee58526b7693e9a34383765d1b905 /gcc/ada/sem_disp.adb
parente40cb362d0b3d49e5dc5a68c5dec1d5672c2832a (diff)
downloadgcc-c95f21001dc9b7dbe717ef84924220192c7b48ae.zip
gcc-c95f21001dc9b7dbe717ef84924220192c7b48ae.tar.gz
gcc-c95f21001dc9b7dbe717ef84924220192c7b48ae.tar.bz2
[Ada] AI12-0170: Abstract subprogram calls in class-wide precond exprs
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.
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 67a8cdf..cf54337 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -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))))