re PR ada/38333 (Illegal program not detected, ARM 6.1(20): pragma Import illegal for abstract subprograms)

gcc/ada/
	PR ada/38333
	* sem_prag.adb (Process_Import_Or_Interface): Forbid an abstract
	subprogram to be completed with a "pragma Import".

    gcc/testsuite/
	PR ada/38333
	* gnat.dg/specs/import_abstract.ads: New.

From-SVN: r152486
This commit is contained in:
Samuel Tardieu 2009-10-06 07:19:54 +00:00 committed by Samuel Tardieu
parent ddd4d0e1ad
commit 6fa30ef281
4 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2009-10-06 Samuel Tardieu <sam@rfc1149.net>
PR ada/38333
* sem_prag.adb (Process_Import_Or_Interface): Forbid an abstract
subprogram to be completed with a "pragma Import".
2009-10-02 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>:

View File

@ -3459,6 +3459,15 @@ package body Sem_Prag is
else
Set_Imported (Def_Id);
if Is_Subprogram (Def_Id)
and then Is_Abstract_Subprogram (Def_Id)
then
Error_Msg_Sloc := Sloc (Def_Id);
Error_Msg_NE
("cannot import abstract subprogram& declared#",
Arg2, Def_Id);
end if;
-- Special processing for Convention_Intrinsic
if C = Convention_Intrinsic then

View File

@ -1,3 +1,8 @@
2009-10-06 Samuel Tardieu <sam@rfc1149.net>
PR ada/38333
* gnat.dg/specs/import_abstract.ads: New.
2009-10-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/35862

View File

@ -0,0 +1,6 @@
-- { dg-do compile }
package Import_Abstract is
type T1 is abstract tagged null record;
procedure p1(X : T1) is abstract;
pragma Import (Ada, p1); -- { dg-error "cannot import abstract subprogram" }
end Import_Abstract;