DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B2013: object of an unconstrained type without bounds

Catalog status: active. Default severity: error. Stable name: indefinite-object. Family: Types and constraints.

An unconstrained array type such as String leaves the bounds to each object. An object declaration must give them, either with an index constraint or through its initial value, whose bounds the object takes. (A parameter takes the bounds of its actual, and a function result those of the returned value.) The same holds of a record type whose discriminants have no defaults, and of a private type declared with unknown discriminants, type T (<>) is private;, outside its package: an object of it takes its value, and so its form, from an initial value, typically a function's result.

Example (Vada)

   Buffer : String;   --  how many characters?

Example (Varc)

    var buffer: String;   // how many characters?

What to do (Vada)

Give the bounds, Buffer : String (1 .. 80);, or an initial value: Buffer : String := "initial text";.

What to do (Varc)

Give the bounds, var buffer: String[1..=80];, or an initial value: var buffer: String = "initial text";.

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.