DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B2003: a static expression is required

Catalog status: active. Default severity: error. Stable name: not-static. Family: Types and constraints.

Some places require a value known at compile time: the bounds of an integer type, a modulus, the value of a named number (N : constant := ...), case choices.

Example (Vada)

   N : Integer := 10;
   type Index is range 1 .. N;

Example (Varc)

    var n: Integer = 10;
    type Index = range 1..=n;

What to do (Vada)

Use literals, named numbers or static constants: N : constant := 10;.

What to do (Varc)

Use literals, named numbers or static constants: let n = 10;.

Regression source and further reading

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

See types and constraints, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.