This patch fixes a bug in the compiler whereby the experimental "return
when" feature was not supported in procedures.

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

gcc/ada/

        * par-ch6.adb (Get_Return_Kind): Properly handle the case of a
        "return when" statement in the procedure case.
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -1903,6 +1903,11 @@ package body Ch6 is
             end if;
 
             Restore_Scan_State (Scan_State); -- to identifier
+
+         elsif Token = Tok_When then
+            Error_Msg_GNAT_Extension ("return when statement");
+
+            Result := Return_When;
          end if;
 
          return Result;


Reply via email to