]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Legal access discriminant default expression incorrectly rejected
authorSteve Baird <baird@adacore.com>
Fri, 30 Aug 2024 21:13:22 +0000 (14:13 -0700)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 8 Oct 2024 08:37:12 +0000 (10:37 +0200)
commit4aa366fcb2a1a1d359207c6826f04be696d5e547
treef2195e7e8b8e52a37f9d95c54bb878bbec6c13a4
parent985b06da41a089ab5d1295177b90813d29032b72
ada: Legal access discriminant default expression incorrectly rejected

If a limited private partial view of a type has an access discriminant with
a default expression, and if the type (perhaps tagged, perhaps not) is
completed by deriving from an immutably limited type, then the default
discriminant expression should not be rejected.

gcc/ada/ChangeLog:

* sem_ch6.adb (Check_Discriminant_Conformance): In testing whether
a default expression is permitted for an access discriminant, we
need to know whether the discriminated type is immutably limited.
Handle another part of this test that cannot easily be handled in
Sem_Aux.Is_Immutably_Limited. This involves declaring a new local
function, Is_Derived_From_Immutably_Limited_Type.
gcc/ada/sem_ch6.adb