If the prefix is a single protected object and the selector is a discriminant
or an entry family, this is a non-overloaded candidate interpretation, and
possible primitive operations of the type must not be examined.

The following must compile and execute quietly in Ada 2005 mode:

---
with FooBar;
procedure Interface_Entry_Family is
   I : FooBar.Index := 1;
begin
   FooBar.Bar.E(I)(1337);
end Interface_Entry_Family;
--
package FooBar is
   type Foo is protected interface;
   procedure P(Self : in out Foo) is abstract;
   
   type Index is range 1..1;

   protected Bar is
   new Foo with -- remove this line, and it will compile.
      
      procedure P;
      
      entry E(Index)(Baz : Integer);
      
   end Bar;
end FooBar;
---
package body FooBar is
   protected body Bar is
      
      procedure P is
      begin
         null;
      end P;
      
      entry E(for I in Index)(Baz : Integer) when True is
      begin
         null;
      end E;      
      
   end Bar;
end FooBar;
---

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-09-27  Ed Schonberg  <schonb...@adacore.com>

        * sem_ch4.adb (Analyze_Selected_Component): If the prefix is a
        single protected object and the selector is a discriminant or an
        entry family, this is a non-overloaded candidate interpretation,
        and possible primitive operations of the type must not be
        examined.

Index: sem_ch4.adb
===================================================================
--- sem_ch4.adb (revision 179247)
+++ sem_ch4.adb (working copy)
@@ -4125,6 +4125,11 @@
                   Set_Entity_With_Style_Check (Sel, Comp);
                   Generate_Reference (Comp, Sel);
 
+                  --  The selector is not overloadable, so we have a candidate
+                  --  interpretation.
+
+                  Has_Candidate := True;
+
                else
                   goto Next_Comp;
                end if;

Reply via email to