]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Predefined arithmetic operators incorrectly treated as directly visible
authorSteve Baird <baird@adacore.com>
Fri, 24 May 2024 00:11:42 +0000 (17:11 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 21 Jun 2024 08:34:18 +0000 (10:34 +0200)
commit244d02bb288a07f3252fc9ed38675b93a9a91225
treeb7a345f17e6c21d5237b27bae4fefa9c56bf0554
parentc5aed359a563c48f616d58f708c398f8494d7731
ada: Predefined arithmetic operators incorrectly treated as directly visible

In some cases, a predefined operator (e.g., the "+" operator for an
integer type) is incorrectly treated as being directly visible when
it is not. This can lead to both accepting operator uses that should
be rejected and also to incorrectly rejecting legal constructs as ambiguous
(for example, an expression "Foo + 1" where Foo is an overloaded function and
the "+" operator is directly visible for the result type of only one of
the possible callees).

gcc/ada/

* sem_ch4.adb (Is_Effectively_Visible_Operator): A new function.
(Check_Arithmetic_Pair): In paths where Add_One_Interp was
previously called unconditionally, instead call only if
Is_Effectively_Visible_Operator returns True.
(Check_Boolean_Pair): Likewise.
(Find_Unary_Types): Likewise.
gcc/ada/sem_ch4.adb