GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Ada: Rejects structural instantiation in generic formal parts.

The Ada compiler now explicitly disallows structural instantiation within generic formal parts, as this feature is currently unsupported.

The Ada compiler will now issue an error if a structural instantiation is attempted within a generic formal part. This type of construct, which would effectively represent a formal package, is not supported by the current compiler implementation. This change improves error reporting by preventing unsupported language constructs from being silently or incorrectly handled, providing clearer feedback to developers.

In Details

In Ada, generic formal parts define the parameters for generic units (like generic packages or subprograms). Structural instantiation refers to the ability to define the structure of a type or package rather than a specific instance. When a structural instantiation is used in a generic formal part, it effectively implies a 'formal package' concept, which is not currently implemented in the Ada front end. The changes in sem_ch3.adb, sem_ch4.adb, and sem_ch12.adb specifically add checks within Analyze_Private_Extension_Declaration, Process_Generic_Instantiation, and `Analyze_Formal_De…

For Context

In programming, 'generics' are like templates that allow you to write code that works with different types or structures without having to rewrite it entirely for each one. For example, you could have a generic list that can hold numbers or text. A 'formal part' defines what kind of things the generic code expects. This change means that the Ada compiler will now actively reject a specific, advanced way of defining these generic parameters, called 'structural instantiation,' if it's used within the formal part. This is because the compiler doesn't yet have the capabilities to understand or process such a complex definition in that context. By rejecting it, the compiler gives you an immediate error message instead of trying to compile something it can't handle, which could lead to more confusing errors later on.

Filed Under: adacompiler-errorslanguage-features