OSDN Git Service

gcc/ada/
authorsam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Oct 2009 07:19:54 +0000 (07:19 +0000)
committersam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Oct 2009 07:19:54 +0000 (07:19 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152486 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/sem_prag.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/specs/import_abstract.ads [new file with mode: 0644]

index 6520a7f..7af8f31 100644 (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>:
index 902cb30..4d56d36 100644 (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
index 13fbf3d..c65aab8 100644 (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
diff --git a/gcc/testsuite/gnat.dg/specs/import_abstract.ads b/gcc/testsuite/gnat.dg/specs/import_abstract.ads
new file mode 100644 (file)
index 0000000..9d05f0c
--- /dev/null
@@ -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;