re PR ada/29015 (Ada 2005 observer pattern with mutually dependent packages and conta...
authorSamuel Tardieu <sam@rfc1149.net>
Wed, 16 Apr 2008 12:37:38 +0000 (12:37 +0000)
committerSamuel Tardieu <sam@gcc.gnu.org>
Wed, 16 Apr 2008 12:37:38 +0000 (12:37 +0000)
    gcc/ada/
PR ada/29015
* sem_ch12.adb (Instantiate_Type): Check whether the full view of
the type is known instead of the underlying type.

    gcc/testsuite/
PR ada/29015
* gnat.dg/incomplete1.ads, gnat.dg/incomplete2.ads,
gnat.dg/incomplete2.adb: New.

From-SVN: r134345

gcc/ada/ChangeLog
gcc/ada/sem_ch12.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/incomplete1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/incomplete2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/incomplete2.ads [new file with mode: 0644]

index 950d1dd..346866e 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-16  Samuel Tardieu  <sam@rfc1149.net>
+
+       PR ada/29015
+       * sem_ch12.adb (Instantiate_Type): Check whether the full view of
+       the type is known instead of the underlying type.
+
 2008-04-15  Ed Schonberg  <schonberg@adacore.com>
 
        PR ada/22387
index c44f392..60833fc 100644 (file)
@@ -9990,7 +9990,7 @@ package body Sem_Ch12 is
                          Ekind (Root_Type (Act_T)) = E_Incomplete_Type)
          then
             if Is_Class_Wide_Type (Act_T)
-              or else No (Underlying_Type (Act_T))
+              or else No (Full_View (Act_T))
             then
                Error_Msg_N ("premature use of incomplete type", Actual);
                Abandon_Instantiation (Actual);
index 4371571..13167d6 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-16  Samuel Tardieu  <sam@rfc1149.net>
+
+       PR ada/29015
+       * gnat.dg/incomplete1.ads, gnat.dg/incomplete2.ads,
+       gnat.dg/incomplete2.adb: New.
+
 2008-04-16  Hans-Peter Nilsson  <hp@axis.com>
 
        PR tree-optimization/35629
diff --git a/gcc/testsuite/gnat.dg/incomplete1.ads b/gcc/testsuite/gnat.dg/incomplete1.ads
new file mode 100644 (file)
index 0000000..3490033
--- /dev/null
@@ -0,0 +1,3 @@
+package Incomplete1 is
+   type T is null record;
+end Incomplete1;
diff --git a/gcc/testsuite/gnat.dg/incomplete2.adb b/gcc/testsuite/gnat.dg/incomplete2.adb
new file mode 100644 (file)
index 0000000..19c8360
--- /dev/null
@@ -0,0 +1,4 @@
+-- { dg-do compile }
+-- { dg-excess-errors "instantiation abandoned" }
+with Incomplete1;
+package body Incomplete2 is end Incomplete2;
diff --git a/gcc/testsuite/gnat.dg/incomplete2.ads b/gcc/testsuite/gnat.dg/incomplete2.ads
new file mode 100644 (file)
index 0000000..21f2d2b
--- /dev/null
@@ -0,0 +1,8 @@
+limited with Incomplete1;
+package Incomplete2 is
+   pragma Elaborate_Body;
+   generic
+      type T is private;
+   package G is end G;
+   package I1 is new G (Incomplete1.T); -- { dg-error "premature use" }
+end Incomplete2;