Blady
2024-02-24 09:50:31 UTC
Hello,
AARM Ada 2022 section 11.3 presents some uses of raise expressions
including this one:
(http://www.ada-auth.org/standards/22aarm/html/AA-11-3.html)
2.a.10/4 ...
B : Some_Array := (1, 2, 3, others => raise
Not_Valid_Error);
What could be the use cases?
My guess: whatever the size of Some_Array (greater than 3), B is
elaborated but raises Not_Valid_Error when accessing component beyond
position 3:
type Some_Array is array (Positive range 1..10) of Natural;
...
B : Some_Array := (1, 2, 3, others => raise Not_Valid_Error);
...
begin
X := B (2); -- OK
X := B (6); -- raises Not_Valid_Error
end;
Is it correct?
Thanks, Pascal.
AARM Ada 2022 section 11.3 presents some uses of raise expressions
including this one:
(http://www.ada-auth.org/standards/22aarm/html/AA-11-3.html)
2.a.10/4 ...
B : Some_Array := (1, 2, 3, others => raise
Not_Valid_Error);
What could be the use cases?
My guess: whatever the size of Some_Array (greater than 3), B is
elaborated but raises Not_Valid_Error when accessing component beyond
position 3:
type Some_Array is array (Positive range 1..10) of Natural;
...
B : Some_Array := (1, 2, 3, others => raise Not_Valid_Error);
...
begin
X := B (2); -- OK
X := B (6); -- raises Not_Valid_Error
end;
Is it correct?
error: "others" choice not allowed here
see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113862Thanks, Pascal.