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

Ada: Correct error message on use of 'Result with wrong prefix.

Fixes an incorrect error message related to the 'Result attribute with a wrong prefix.

An incorrect error message was being displayed when using the ‘Result attribute with the wrong prefix. This commit renames Is_Access_Subprogram_Wrapper to Is_Access_To_Subprogram_Wrapper and updates calls to this function throughout the code. It also adds an assertion and modifies the analysis of the Attribute_Result to accurately report the expected prefix.

In Details

This patch modifies sem_util.ads, sem_util.adb, sem_disp.adb, sem_prag.adb, exp_ch6.adb, and sem_attr.adb to address an issue with the error message produced when using the 'Result attribute with an incorrect prefix. The core change is renaming Is_Access_Subprogram_Wrapper to Is_Access_To_Subprogram_Wrapper and adjusting the logic within Analyze_Attribute [Attribute_Result] to provide a more accurate error message.

For Context

Ada has a feature called 'attributes', which allow you to query properties of entities in the code. The 'Result attribute gives you access to the result of a function. This commit fixes a bug where the compiler was giving an incorrect error message when the 'Result attribute was used with the wrong prefix (i.e., applied to the wrong kind of entity).

Filed Under: adaerror messageattributesbugfix