From: Eric Botcazou <ebotca...@adacore.com>

This happens for example with:

package Q3 is
  type Types is (One, Two);
end Q3;

with Q3;

package P3 is
  Kind : Q3.Types := Q3.Types.One;
end P3;

and prevents the error from being given.

gcc/ada/ChangeLog:

        PR ada/112979
        * sem_ch8.adb (Find_Selected_Component): Try to recognize the
        object operation notation only if the selector is a subprogram.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_ch8.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 2007db368ed..449bfa89735 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -8535,7 +8535,7 @@ package body Sem_Ch8 is
                         Current_Entity (Selector_Name (N));
                begin
                   if Present (F)
-                    and then Is_Overloadable (F)
+                    and then Is_Subprogram (F)
                     and then Present (First_Entity (F))
                     and then not Is_Tagged_Type (Etype (First_Entity (F)))
                   then
-- 
2.43.0

Reply via email to