]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Operator visibility bug in static expression functions
authorSteve Baird <baird@adacore.com>
Mon, 24 Jun 2024 18:57:59 +0000 (11:57 -0700)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 1 Aug 2024 15:14:35 +0000 (17:14 +0200)
In some cases, an expanded name refering to a predefined operator (such as
Some_Package."+") occurring in a static expression function would be
incorrectly rejected with a message saying that the operator is not directly
visible (which, while True, does not make the reference illegal).

gcc/ada/

* sem_ch4.adb (Is_Effectively_Visible_Opertor): Return True if
Checking_Potentially_Static_Expression is True. The accompanying
comment says True is returned "if there is a reason it is ok for
Is_Visible_Operator to return False"; if
Checking_Potentially_Static_Expression is true, that is such a
reason.

gcc/ada/sem_ch4.adb

index 2281ef9ce71bce91bda329050e6bf6e9d19b1939..fc3a2a43c3c9c1e3168e67d82510ff3ec3277a99 100644 (file)
@@ -278,6 +278,7 @@ package body Sem_Ch4 is
            (N /= Original_Node (N)
              and then Is_Effectively_Visible_Operator
                         (N => Original_Node (N), Typ => Typ))
+         or else Checking_Potentially_Static_Expression
          or else not Comes_From_Source (N));
    --  Return True iff either Is_Visible_Operator returns True or if
    --  there is a reason it is ok for Is_Visible_Operator to return False.