]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Error in prefix-notation call
authorBob Duff <duff@adacore.com>
Thu, 12 Oct 2023 19:52:27 +0000 (15:52 -0400)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 7 Nov 2023 09:15:03 +0000 (10:15 +0100)
The compiler gives a wrong error for a call of the form X.Y(...)
when Y is inherited indirectly via an interface.

gcc/ada/

* sem_ch4.adb (Is_Private_Overriding): Return True in the case
where a primitive operation is publicly inherited but privately
overridden.

gcc/ada/sem_ch4.adb

index 50ba6c9c847c408e66298159b91ec50baed43d02..2f3dfe71590d4b30c9f77b15e2a0d85cb5f4013f 100644 (file)
@@ -10223,9 +10223,15 @@ package body Sem_Ch4 is
 
                elsif not Comes_From_Source (Visible_Op)
                  and then Alias (Visible_Op) = Op
-                 and then not Is_Hidden (Visible_Op)
                then
-                  return True;
+                  --  If Visible_Op or what it overrides is not hidden, then we
+                  --  have found what we're looking for.
+
+                  if not Is_Hidden (Visible_Op)
+                    or else not Is_Hidden (Overridden_Operation (Op))
+                  then
+                     return True;
+                  end if;
                end if;
 
                Visible_Op := Homonym (Visible_Op);