https://gcc.gnu.org/g:d4aa557fc81f266a3764a8b34f701a2064ec7b47
commit r17-740-gd4aa557fc81f266a3764a8b34f701a2064ec7b47 Author: Eric Botcazou <[email protected]> Date: Fri Jan 16 00:31:16 2026 +0100 ada: Small tweak to error message for premature freezing of deferred constant The tweak is to add the name of the constant to the error message. That's a minor improvement in this simple case, but it will help for the same error in a more complex case. gcc/ada/ChangeLog: * sem_res.adb (Resolve_Entity_Name): Add the name of the constant to the error message for premature freezing of deferred constants. Diff: --- gcc/ada/sem_res.adb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 5b90d4ee7a14..afe82549995d 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -8156,16 +8156,12 @@ package body Sem_Res is and then not Is_Imported (E) and then Nkind (Parent (E)) /= N_Object_Renaming_Declaration and then not Needs_Construction (Etype (E)) + and then not No_Initialization (Parent (E)) + and then not (Present (Full_View (E)) + and then No_Initialization (Parent (Full_View (E)))) then - if No_Initialization (Parent (E)) - or else (Present (Full_View (E)) - and then No_Initialization (Parent (Full_View (E)))) - then - null; - else - Error_Msg_N - ("deferred constant is frozen before completion", N); - end if; + Error_Msg_NE + ("deferred constant& is frozen before completion", N, E); end if; Eval_Entity_Name (N);
