Files
gcc-reflection/gcc/testsuite/gnat.dg/cpp_constructor2.adb
Javier Miranda 2fdc20b65c [Ada] Crash in C++ constructor without external and link name
The compiler blows up processing the declaration of a tagged type
variable that has a C++ constructor without external or link name. After
this patch the frontend reports an error.

2019-07-22  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* freeze.adb (Freeze_Subprogram): Check that C++ constructors
	must have external or link name.

gcc/testsuite/

	* gnat.dg/cpp_constructor2.adb: New testcase.

From-SVN: r273670
2019-07-22 13:56:36 +00:00

20 lines
433 B
Ada

-- { dg-do compile }
procedure CPP_Constructor2 is
package P is
type X is tagged limited record
A, B, C, D : Integer;
end record;
pragma Import (Cpp, X);
procedure F1 (V : X);
pragma Import (Cpp, F1);
function F2 return X; -- { dg-error "C\\+\\+ constructor must have external name or link name" }
pragma Cpp_Constructor (F2);
end P;
begin
null;
end CPP_Constructor2;