The following example:

package Test is
   type X is limited interface;
   function Return_X return X is abstract;

   task type Y is new X with 
   end Y;
   overriding function Return_X return Y;
end Test;

does not compile with the following message:
    test.ads:9:20: subprogram "Return_X" is not overriding.

As far as I can judge, it because of the following check in
gcc/ada/sem_util.adb (function Find_Overridden_Synchronized_Primitive,
line 3070):
...
   and then Etype (Result_Definition (Parent (Def_Id))) =
            Etype (Result_Definition (Parent (Subp)))
...
(the code can be traced back to at least gcc 4.1.2)

I am not sure that this is indeed a bug in the compiler and not some obscure
feature of the standard, though I failed to find in the ARM any explicit
prohibition for controlling-result functions of synchronized types.


-- 
           Summary: functions with controlling result do not work with
                    synchronized interfaces
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Artem dot Andreev at oktetlabs dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38974

Reply via email to