DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
B1014: pragma not allowed here
Catalog status: active. Default severity: error. Stable name: misplaced-pragma. Family: Names and declarations.
pragma Loop_Invariant must appear directly among a loop's statements (not inside an if or a block in the loop), where it states what holds on every iteration at that point.
Example (Vada)
for I in 1 .. 10 loop
if I > 5 then
pragma Loop_Invariant (X >= 0);
end if;
end loop;Example (Varc)
for i in 1..=10 {
if i > 5 {
invariant x >= 0;
}
}
What to do
Move the invariant to the loop's own statement list, usually at the start of the body.
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See names and declarations, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.