DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B0703: argument of an out or inout parameter without &

Catalog status: active. Default severity: error. Stable name: reference-mark-missing. Family: Syntax and source text.

Varc marks every argument that a call may change: the argument of an out or inout parameter is written &x. A reader then sees at the call which variables it changes, as in C's &x and Rust's &mut x, without looking up the subprogram.

Example (Varc)

fn swap(a, b: inout Integer) {
    let t = a;
    a = b;
    b = t;
}

fn main() {
    var x: Integer = 1;
    var y: Integer = 2;
    swap(x, y);
}

What to do

Mark the arguments: swap(&x, &y);. (Vada needs no mark: Ada's parameter modes are part of the subprogram, not the call.)

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See syntax and source text, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.