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 950d1ddaaddfdd1cd62d0a09d9e99f30b58b15f1..346866e9215e058527ee5a90fb6e4f1530cffd77 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 c44f3929d507b8b537ae867e42be458a3c48fbb3..60833fc2bdb84ced3b156cada543e81303b41c18 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 43715717330efc94cbf8f5aff293c41b0ac34c66..13167d6ef188f30356f021891444b6ad32900726 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;