The error message named in the subject baffles me. I tried a MWE, to no avail: the error doesn’t reproduce. I tried pruning things down to a MWE, to no avail (so far): the error persists. If I figure it out, I’ll update, but if anyone has a hint, I’d be immensely grateful…
Without supplying hundreds of lines of code from 7 source files, the setup is: (not real names)
generic First_Value: Positive; package A
, no bodygeneric Second_Value: Positive; package A.B
, with bodygeneric package A.B.C
, with bodygeneric package A.D
, no bodypackage P
, the main (test) program
(If it matters, they’re all in separate files.)
P
use
s all the names packages. The error is equivalent to
a-b-c.adb:8:01: error: cannot supply body for package renaming
But package A.B.C
never appears in a renames
clause, so what on earth is the error message referring to?!?
I suspect it has something to do with generics, but I can’t tell, nor can I make sense of the relevant compiler code:
if Present (Corresponding_Spec (N)) then
-- Body is body of package instantiation. Corresponding spec has
-- already been set.
Spec_Id := Corresponding_Spec (N);
Pack_Decl := Unit_Declaration_Node (Spec_Id);
else
Spec_Id := Current_Entity_In_Scope (Defining_Entity (N));
if Present (Spec_Id)
and then Is_Package_Or_Generic_Package (Spec_Id)
then
Pack_Decl := Unit_Declaration_Node (Spec_Id);
if Nkind (Pack_Decl) = N_Package_Renaming_Declaration then
Error_Msg_N ("cannot supply body for package renaming", N);
return;