https://gcc.gnu.org/g:8b2c93cb5fa3892f55673f579f5d422fcba49aa2
commit r16-9039-g8b2c93cb5fa3892f55673f579f5d422fcba49aa2 Author: Viljar Indus <[email protected]> Date: Wed Apr 8 13:02:06 2026 +0300 ada: Improve error message for incorrect call arguments Enumeration literals are considered as zero argument functions. This is not obvious for most users and can create confusing error messages when an enumeration literal is referred to as a call. For example if there are indices applied to it. Instead create a dedicated error message for this scenario. gcc/ada/ChangeLog: * sem_util.adb (Normalize_Actuals): Improve error message. Diff: --- gcc/ada/sem_util.adb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index c1bf51beb3d5..e28215f559eb 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -25949,7 +25949,19 @@ package body Sem_Util is if Reporting then if Is_Entity_Name (Name (N)) then - Error_Msg_N ("too many arguments in call to&", Name (N)); + if Ekind (S) = E_Enumeration_Literal then + Error_Msg_N ("cannot index enumeration literal &", Name (N)); + if Present (Homonym (S)) + and then Sloc (Homonym (S)) = Standard_Location + then + Error_Msg_NE + ("\\did you mean & in Standard'?", + Name (N), + Homonym (S)); + end if; + else + Error_Msg_N ("too many arguments in call to&", Name (N)); + end if; else Error_Msg_N ("too many arguments in call", N); end if;
