gnu/gcc/304a75b1b2a748e8bb94fd80a31a6e20da7fe6e8 Ada: Fix assertion failure for unfrozen mutably tagged type as actual
This is a follow-up to the fix done last December at:
https://gcc.gnu.org/pipermail/gcc-patches/2025-December/704521.html
The fix is not sufficient when nested layers of generics are involved,
so this changes the implementation of mutably tagged types to have the
declaration of their CW-equivalent type immediately analyzed. But this
in turn requires making sure that the root type is frozen before the
CW-equivalent type in all cases.
gcc/ada/
PR ada/123306
* freeze.adb (Freeze_Entity): For a class-wide equivalent type of
a non-interface root type, freeze the root type before it.
* sem_ch3.adb (Derived_Type_Declaration): Minor tweak.
* sem_ch12.adb (Analyze_One_Association): Revert latest change.
* sem_ch13.adb (Analyze_Attribute_Definition_Clause) <Size>: When
the prefix is a class-wide type, insert the declaration of the CW-
equivalent type immediately after that of the root type, and the
size check for the root type into its own freezing actions.
gcc/testsuite/
* gnat.dg/specs/mutably_tagged2.ads: New test.
5 files changed