[Ada] Fix bogus "too late" error with nested generics and inlining
This prevents the compiler from issuing a bogus error about a constant
whose full declaration appears too late, if it is declared in a nested
generic package and instantiated in another nested instantiation, when
the instantiations are done in a unit withed from the main unit and
containing an inlined subprogram, and cross-unit inlining is enabled.
It turns out that, under these very peculiar conditions, the compiler
ends up instantiating the body of the generic package twice, which leads
to various semantic errors, in particular for declarations of constants.
2019-09-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch12.adb (Instantiate_Package_Body): Check that the body
has not already been instantiated when the body of the parent
was being loaded.
gcc/testsuite/
* gnat.dg/inline21.adb, gnat.dg/inline21_g.ads,
gnat.dg/inline21_h.adb, gnat.dg/inline21_h.ads,
gnat.dg/inline21_q.ads: New testcase.
From-SVN: r275953