Issue an error if a pragma convention stdcall is applied to a
dispatching subprogram. Such subprogram cannot be used to interface
to the Win32 API, so in fact this check does not impose any new
restrictions.

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

2011-11-21  Pascal Obry  <o...@adacore.com>

        * sem_prag.adb (Process_Convention): A dispatching call cannot
        have a stdcall calling convention.

Index: sem_prag.adb
===================================================================
--- sem_prag.adb        (revision 181563)
+++ sem_prag.adb        (working copy)
@@ -3527,8 +3527,9 @@
          --  For Stdcall, a subprogram, variable or subprogram type is required
 
          if C = Convention_Stdcall
-           and then not Is_Subprogram (E)
-           and then not Is_Generic_Subprogram (E)
+           and then
+             ((not Is_Subprogram (E) and then not Is_Generic_Subprogram (E))
+                or else Is_Dispatching_Operation (E))
            and then Ekind (E) /= E_Variable
            and then not
              (Is_Access_Type (E)

Reply via email to