]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Reference to nonexistent operator in reduction expression accepted
authorSteve Baird <baird@adacore.com>
Thu, 16 May 2024 21:49:17 +0000 (14:49 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 20 Jun 2024 08:50:58 +0000 (10:50 +0200)
commit301927d93356871f606ff3db2549bb5d44e74516
tree5a33f73d57e658b28ac5b7ac18a1c5a6925a736c
parent4c98b695fd8ee8246d84ba954dd59ddb87ac16d7
ada: Reference to nonexistent operator in reduction expression accepted

In some cases, a reduction expression that references the (nonexistent)
"+" operator of a generic formal private type is incorrectly accepted.

gcc/ada/

* sem_attr.adb (Resolve_Attribute.Proper_Op): When resolving the
name of the reducer subprogram in a reduction expression,
Proper_Op treats references to operators defined in Standard
specially. Disable this special treatment if the type of the
reduction expression is not the right class of type for the
operator, or if a new Boolean parameter (named "Strict") is True.
(Resolve_Attribute): In the overloaded case, iterate over the
reducer subprogram candidates twice. First with Strict => True and
then, if no good intepretation is found, with Strict => False.
gcc/ada/sem_attr.adb