Overloading is defined for subprograms, enumeration literals, operators, and single entries, and also for the operations that are inherent in several basic operations such as assignment, membership tests, allocators, the literal null, aggregates, and string literals.
For overloaded entities, overload resolution determines the actual meaning that an occurrence of an identifier has, whenever the visibility rules have determined that more than one meaning is acceptable at the place of this occurrence; overload resolution likewise determines the actual meaning of an occurrence of an operator or some basic operation.
At such a place all visible declarations are considered. The occurrence is only legal if there is exactly one interpretation of each constituent of the innermost complete context; a complete context is one of the following:
When considering possible interpretations of a complete context, the only rules considered are the syntax rules, the scope and visibility rules, and the rules of the form described below.
Similarly, the simple names given in context clauses (see 10.1.1) and in address clauses (see 13.5) follow different rules.
If there is only one possible interpretation, the identifier denotes the corresponding entity. However, this does not mean that the occurrence is necessarily legal since other requirements exist which are not considered for overload resolution; for example, the fact that an expression is static, the parameter modes, whether an object is constant, conformance rules, forcing occurrences for a representation clause, order of elaboration, and so on.
Similarly, subtypes are not considered for overload resolution (the violation of a constraint does not make a program illegal but raises an exception during program execution).
A loop parameter specification is a declaration, and hence a complete context.
Rules that require certain constructs to have the same parameter and result type profile fall under the category (a); the same holds for rules that require conformance of two constructs since conformance requires that corresponding names be given the same meaning by the visibility and overloading rules.
References: aggregate, allocator, assignment, basic operation, case statement, class of type, declaration, entry, enumeration literal, exception, expression, formal part, identifier, legal, literal, loop parameter specification, membership test, name, null literal, operation, operator, overloading, pragma, representation clause, statement, static expression, static subtype, subprogram, subtype, type conversion, visibility.
Rules of the form (a): address clause, assignment, choice, and 4.3.2, and 5.4, component association, and 4.3.2, conformance rules, default expression, and 3.7.1, and 6.1, and 12.1.1, delay statement, discrete range, and 5.5, and 9.5, discriminant constraint, enumeration representation clause, generic parameter association, index constraint, index expression, and 4.1.2, and 9.5, initial value, membership test, parameter association, parameter and result type profile, and 12.3.6, qualified expression, range constraint, renaming of an object, result expression.
Rules of the form (b): abort statement 9.10, assignment 5.2, case expression 5.4, condition 5.3 5.5 5.7 9.7.1, discrete range 3.6.1 5.5 9.5, fixed point type declaration 3.5.9, floating point type declaration 3.5.7, integer type declaration 3.5.4, length clause 13.2, membership test 4.4, number declaration 3.2.2, record representation clause 13.4, selected component 4.1.3, short-circuit control form 4.4, val attribute 3.5.5
Rules of the form (c): indexed component 4.1.1, selected component 4.1.3, slice 4.1.2
Rules of the form (d): aggregate 4.3, allocator 4.8, membership test 4.4, null literal 4.2, numeric literal 2.4, short-circuit control form 4.4, string literal 4.2
Rationale references: 11.5 Overload Resolution, 11.5.1 Context of Overload Resolution, 11.5.2 Information Used to Resolve Overloading, 11.5.3 Ambiguity
Style Guide references: 8.2.5 Overloading in Generic Units
Address any questions or comments to email@example.com.