Message ID | 20170502081827.GA127823@adacore.com |
---|---|
State | New |
Headers | show |
Index: sem_ch8.adb =================================================================== --- sem_ch8.adb (revision 247461) +++ sem_ch8.adb (working copy) @@ -8562,6 +8562,14 @@ else Error_Msg_N ("object& cannot be used before end of its declaration!", N); + + -- If the premature reference appears as the expression in its own + -- declaration, rewrite it to prevent compiler loops in subsequent + -- uses of this mangled declaration in address clauses. + + if Nkind (Parent (N)) = N_Object_Declaration then + Set_Entity (N, Any_Id); + end if; end if; end Premature_Usage;