]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix missing detection of late equality operator returning subtype of Boolean
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 5 Jan 2025 16:34:41 +0000 (17:34 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 9 Jan 2025 12:56:39 +0000 (13:56 +0100)
commit3b694271bec01ed971147a0f4cb68d8c9a7d0915
tree36c21a41650004154b82c0433e276796a8dabc33
parentf622acc1eb2679f14758a1ad6c5b693cd9bdea23
ada: Fix missing detection of late equality operator returning subtype of Boolean

In Ada 2012, the compiler fails to check that a primitive equality operator
for an untagged record type must appear before the type is frozen, when the
operator returns a subtype of Boolean.  This plugs the legality loophole but
adds the debug switch -gnatd_q to go back to the previous state.

gcc/ada/ChangeLog:

PR ada/18765
* debug.adb (d_q): Document new usage.
* sem_ch6.adb (New_Overloaded_Entity): Apply the special processing
to all equality operators whose base result type is Boolean, but do
not enforce the new Ada 2012 freezing rule if the result type is a
proper subtype of it and the -gnatd_q switch is specified.
gcc/ada/debug.adb
gcc/ada/sem_ch6.adb