diff mbox

[Ada] A dispatching call cannot have a stdcall calling convention

Message ID 20111121113848.GA18046@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Nov. 21, 2011, 11:38 a.m. UTC
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  <obry@adacore.com>

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

Patch

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)