GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/ada

Ada: Fix operator resolution for nonlocal subtype of Integer

Fixes incorrect operator resolution in Ada for subtypes of Integer, preventing spurious ambiguities.

This change corrects an issue in Ada’s overload resolution where operators for nonlocal subtypes of Integer were sometimes incorrectly visible, leading to spurious ambiguities. The fix specifically addresses cases involving integer literals and overloaded operations with universal numeric types, ensuring correct operator selection.

In Details

The Ada front-end's semantic analysis in sem_type.adb incorrectly handled operator visibility for subtypes of Integer. This commit refines the Has_Compatible_Type routine to align with Covers and correctly manage operator resolution when the result type is a universal numeric type, particularly in the presence of multiple candidate interpretations during overload resolution.

For Context
overload resolution
The process by which a compiler determines which specific function or operator to use when multiple options with the same name exist, based on the types and number of arguments.
universal numeric type
In Ada, a type that represents a range of numeric values without a fixed, concrete type, allowing for flexible mathematical operations before being resolved to a specific type.
Filed Under: adacompilersemantics