Semantic Error 56

This error occurs when the type of an array’s subtype declaration does not match the type of the array’s index. The error also occurs when the range of the array is not of the expected type, such as an array with constant, discrete, or static elements. To avoid this error, always make sure that your array’s index matches the type of the array.

To fix this problem, use a renaming declaration that is the first declarative item in the body or main program. It must follow the declaration for the embedded package. If the renaming declaration refers to a subprogram in another package, it must match the original specification of that subprogram. Moreover, it must have the same type and not have any different parameter names.

Another common cause of this error is a failure to declare a package or its own variable. This problem occurs when a function calls a procedure with an export. It is also a problem when a user-defined subprogram calls a package’s initialization part. And the omission of the specification in the parent unit may lead to omitting body entries.

Besides this problem, a private child package’s own variables must be in the same refinement constituents as the package’s owner. If they’re in the initialization clause, the Examiner may see the child package before the owner. It’s also possible for the same variable to occur twice, causing semantic error 56.

Another semantic error is Semantic Error 618. This happens when a package inherits a remote package from its private child package. In Ada 95, this is not allowed. In the case of a private child package, it must inherit from its parent. Similarly, an embedded package must inherit from its parent package.

Another error is a flow error. A flow error indicates that the statement or expression contains references to variables that are not defined. Those references should be removed or changed if they do not match the type of variable being used. In other cases, a flow error indicates a dependency. It can also occur when an imported-only variable is used in the derivation of a variable.

Lastly, the error may occur when a numeric literal is used that is illegal, such as when the digits are not in the correct base. In addition, a static expression can also cause a constraint error. Using the name of an embedded package as a variable in another package can cause the error to occur.

In general, the error occurs when the name of a variable or subprogram does not match the name of the variable or subprogram declared in the visible part of the package. The exception to this rule is if a subprogram or variable is declared in a refinement clause or after a pragma interface is defined.