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

Ada: Fix spurious error with First_Controlling_Parameter type

Fixes a false error when dispatching primitives have formals with First_Controlling_Parameter types.

The Ada frontend was incorrectly reporting an error when a dispatching primitive of a tagged type had additional formal parameters with types that have the First_Controlling_Parameter aspect. This commit corrects this behavior by ensuring that such formals are not considered candidate controlling parameters when they are not the first formal parameter of the dispatching primitive.

In Details

Addresses a bug in sem_disp.adb (Check_Controlling_Formals) where formals with the First_Controlling_Parameter aspect were incorrectly flagged as errors. This occurred when these formals were not the first formal of a dispatching primitive.

For Context

In Ada, tagged types are used for polymorphism, where the specific type of an object can be determined at runtime. Dispatching primitives are subprograms that operate on these tagged types. The First_Controlling_Parameter aspect specifies that a particular parameter controls which version of a subprogram is called. This commit fixes a bug where the compiler was incorrectly flagging an error related to these features when used together, ensuring proper handling of dispatching in polymorphic code.

Filed Under: adacompilerbugfix