[Ada] Ensure constructor is a C++ constructor

Message ID 20191010152947.GA87696@adacore.com
State New
Headers show
Series
  • [Ada] Ensure constructor is a C++ constructor
Related show

Commit Message

Pierre-Marie de Rodat Oct. 10, 2019, 3:29 p.m.
Freeze_Subprogram has special handling of C++ constructor interfacing.
This is currently implicit but assuming we introduce other conventions
(e.g. Java) the current code won't hold.

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

2019-10-10  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* freeze.adb (Freeze_Subprogram): Ensure constructor is a C++
	constructor.

Patch

--- gcc/ada/freeze.adb
+++ gcc/ada/freeze.adb
@@ -8780,6 +8780,7 @@  package body Freeze is
       --  (either in pragma CPP_Constructor or in a pragma import).
 
       if Is_Constructor (E)
+        and then Convention (E) = Convention_CPP
         and then
            (No (Interface_Name (E))
               or else String_Equal