[Bug ada/58881] crash for instantiation on tagged private type with unknown discriminants
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Nov 2 18:43:42 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58881
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eric Botcazou <ebotcazou@gcc.gnu.org>:
https://gcc.gnu.org/g:12f3c63de3b4e53b63347c4bee6a82ce66d0078a
commit r16-4934-g12f3c63de3b4e53b63347c4bee6a82ce66d0078a
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Sun Nov 2 19:36:16 2025 +0100
Ada: Fix crash on tagged private type with unknown discriminants
This is an old issue with the extension of a tagged private type declared
with unknown discriminants in the public part of a generic child unit,
although the generic context is not a key factor (i.e. this also happens
for a nongeneric child unit). The public part of a child unit does not
have visibility on the private part of its parent, so the extension also
has unknown discriminants.
gcc/ada/
PR ada/58881
* sem_ch3.adb (Build_Derived_Private_Type): Build the underlying
full view when the derivation occurs in the public part of the
scope of the parent.
(Build_Derived_Record_Type): Propagate Has_Unknown_Discriminants
in the same circumstances.
(Constrain_Discriminated_Type): Give a specific error message for
any type with the Has_Unknown_Discriminants flag.
gcc/testsuite/
* gnat.dg/specs/unknown_discr1.ads: New test.
* gnat.dg/specs/unknown_discr1_pkg.ads: New helper.
* gnat.dg/specs/unknown_discr1_pkg-child.ads: Likewise.
* gnat.dg/specs/unknown_discr1_pkg-g.ads: Likewise.
* gnat.dg/specs/unknown_discr1_pkg-inst.ads: Likewise.
More information about the Gcc-bugs
mailing list