OSDN Git Service

New tests.
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Aug 2008 09:16:07 +0000 (09:16 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Aug 2008 09:16:07 +0000 (09:16 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138782 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/iface_test.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/iface_test.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/test_call.adb [new file with mode: 0644]

index 92c95cc..7a1b82c 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-06  Arnaud Charlet  <charlet@adacore.com>
+
+       * gnat.dg/iface_test.ad[s,b]: New test.
+       * gnat.dg/test_call.adb: New test.
+
 2008-08-06  Andreas Krebbel  <krebbel1@de.ibm.com>
 
        * gcc.c-torture/compile/20080806-1.c: New testcase.
diff --git a/gcc/testsuite/gnat.dg/iface_test.adb b/gcc/testsuite/gnat.dg/iface_test.adb
new file mode 100644 (file)
index 0000000..b47814f
--- /dev/null
@@ -0,0 +1,28 @@
+--  { dg-do compile }
+package body Iface_Test is
+   protected SQLite_Safe is
+      function Prepare_Select
+        (DB   : DT_1;
+         Iter : Standard.Iface_Test.Iface_2'Class)
+      return Standard.Iface_Test.Iface_2'Class;
+   end;
+
+   overriding procedure Prepare_Select
+     (DB   : DT_1;
+      Iter : in out Standard.Iface_Test.Iface_2'Class)
+   is
+   begin
+      Iter := SQLite_Safe.Prepare_Select (DB, Iter);  --  test
+   end;
+
+   protected body SQLite_Safe is
+      function Prepare_Select
+        (DB   : DT_1;
+         Iter : Standard.Iface_Test.Iface_2'Class)
+        return Standard.Iface_Test.Iface_2'Class
+      is
+      begin
+         return Iter;
+      end;
+   end;
+end;
diff --git a/gcc/testsuite/gnat.dg/iface_test.ads b/gcc/testsuite/gnat.dg/iface_test.ads
new file mode 100644 (file)
index 0000000..d093c28
--- /dev/null
@@ -0,0 +1,18 @@
+package Iface_Test is
+   type Iface_1 is interface;
+   type Iface_2 is interface;
+   
+   procedure Prepare_Select
+     (DB   : Iface_1;
+      Iter : in out Iface_2'Class) is abstract; 
+        
+   type DT_1 is new Iface_1 with null record;
+        
+   type Iterator is new Iface_2 with record
+      More : Boolean;
+   end record;
+
+   overriding procedure Prepare_Select
+     (DB   : DT_1;
+      Iter : in out Standard.Iface_Test.Iface_2'Class);
+end;
diff --git a/gcc/testsuite/gnat.dg/test_call.adb b/gcc/testsuite/gnat.dg/test_call.adb
new file mode 100644 (file)
index 0000000..f1ea10f
--- /dev/null
@@ -0,0 +1,24 @@
+--  { dg-do compile }
+
+with System; with Ada.Unchecked_Conversion;
+procedure Test_Call is
+   type F_ACC is access function (Str : String) return String;
+        
+   function Do_Something (V : F_Acc) return System.Address is
+   begin
+      return System.Null_Address;
+   end Do_Something;
+
+   function BUG_1 (This : access Integer) return F_Acc is
+   begin
+      return null;
+   end BUG_1;
+
+   function Unch is new Ada.Unchecked_Conversion (F_Acc, System.Address);
+   Func : System.Address := Unch (BUG_1 (null));
+
+   V : System.Address := Do_Something (BUG_1 (null));
+
+begin
+   null;
+end Test_Call;