DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B1016: package body not allowed

Catalog status: active. Default severity: error. Stable name: body-not-allowed. Family: Names and declarations.

A library package may have a body only when its specification needs one (it declares subprograms or generics that the body must complete, or a nested package whose own specification needs a body), or when the specification asks for one with Elaborate_Body (RM 7.2(4)). Otherwise the body would be silently optional, and a stale one could be left out of a build. A package nested in another unit may have a body whether its specification needs one or not: its body is in the same unit, so it cannot be left out.

Example (Vada)

package Tables is
   Squares : Squares_Table := (others => 0);
end Tables;

package body Tables is   --  nothing in Tables needs a body
begin
   ...
end Tables;

What to do

Add with Elaborate_Body to the specification, or remove the body.

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.