When a compile-time constraint error is inserted into the AST, we emit
a main message (e.g. "value not in range of ...") and its continuation
(e.g. "Constraint_Error will be raised at run time"). When the main
message is emitted as a warning and the continuation is escalated into
an error, the main message should be escalated into an error as well.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* errout.adb (Error_Msg_Internal): Propagate warnings-as-error
flag from continuation message to its preceding messages.
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -1240,10 +1240,13 @@ package body Errout is
or else
Warning_Treated_As_Error (Get_Warning_Tag (Cur_Msg)));
- -- Propagate Warn_Err to this message and preceding continuations
+ -- Propagate Warn_Err to this message and preceding continuations.
+ -- Likewise, propagate Is_Warning_Msg, because the current continued
+ -- message could have been escalated from warning to error.
for J in reverse 1 .. Errors.Last loop
Errors.Table (J).Warn_Err := Warn_Err;
+ Errors.Table (J).Warn := Is_Warning_Msg;
exit when not Errors.Table (J).Msg_Cont;
end loop;