]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix inheritance of Is_Primitive and legality check for nonoverridable aspects
authorDenis Mazzucato <mazzucato@adacore.com>
Fri, 20 Jun 2025 15:10:05 +0000 (17:10 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 9 Sep 2025 12:39:53 +0000 (14:39 +0200)
commit54baf2a92bc5f328b93e8880cba6b2623e9081ff
tree5ab3e58bece25e036d65040185d6663b38a5c4c1
parent77db91aae8dd9ce61c01c74bbc3d66cd990a7526
ada: Fix inheritance of Is_Primitive and legality check for nonoverridable aspects

This patch fixes the identification of inherited subprograms as primitive
operations via the Is_Primitive flag. This is essential in the context of the
new legality check which makes sure that, if any subprogram denoted by a
nonoverridable aspect of a type T with formal or return of either type T or
access T, then all denoted subprograms should be primitive operations. Note
that all valid interpretations of a subprogram are denoted by the aspect under
evaluation, all of these needs to be primitive then.

This is a respin of eng/toolchain/gnat!2039

gcc/ada/ChangeLog:

* sem_ch13.adb (Check_Nonoverridable_Aspect_Subprograms): Add the new
legality check in Check_Nonoverridable_Aspect_Subprograms for
nonoverridable aspects to check whether the denoted subprograms satisfy
MR 13.1.1(18.4/6), otherwise we emit an error. Fix spacing.
* sem_ch6.adb (New_Overloaded_Entity): Set Is_Primitive flag
for inherited primitives, and filter out homonym candidates without a
function specification as parents.
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch6.adb