DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
B1010: return statement does not fit its subprogram
Catalog status: active. Default severity: error. Stable name: misplaced-return. Family: Names and declarations.
A function must contain at least one return statement, and every return in it must give a value; a procedure's return statements must not give one (Ada RM 6.5).
Example (Vada)
procedure Show is
begin
return 1;
end Show;Example (Varc)
fn show() {
return 1;
}
What to do
Make the subprogram a function, or remove the value; give every path of a function a return Value;.
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.