DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B0704: & on the argument of an in parameter

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

In Varc & marks an argument the call may change, the argument of an out or inout parameter. This one is for an in parameter, which the call only reads, so the mark would mislead.

Example (Varc)

fn show(n: Integer) {
    Ada.Text_IO.Put_Line(Integer::Image(n));
}

fn main() {
    let x: Integer = 1;
    show(&x);
}

What to do

Remove the &: show(x);.

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.