@@ -16453,7 +16453,9 @@ package body Sem_Util is
while Present (Par)
and then Nkind (Par) /= N_Pragma_Argument_Association
loop
- if Nkind (Original_Node (Par)) = N_And_Then then
+ if Is_Rewrite_Substitution (Par)
+ and then Nkind (Original_Node (Par)) = N_And_Then
+ then
return True;
end if;
new file mode 100644
@@ -0,0 +1,20 @@
+-- { dg-do compile }
+-- { dg-options "-gnatd.F -gnatwa" }
+
+with Ada.Dispatching;
+
+procedure Contract1 with SPARK_Mode is
+
+ function Foo return Boolean is
+ begin
+ Ada.Dispatching.Yield;
+ return True;
+ end Foo;
+
+ Dummy : constant Integer := 0;
+
+begin
+ if Foo and then True then
+ raise Program_Error;
+ end if;
+end Contract1;