2008-08-05 Ed Schonberg <schonberg@adacore.com>
authorEd Schonberg <schonberg@adacore.com>
Tue, 5 Aug 2008 15:11:19 +0000 (17:11 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 5 Aug 2008 15:11:19 +0000 (17:11 +0200)
* freeze.adb:
(Freeze_Entity): A deferred constant does not violate the restriction
No_Default_Initialization,

From-SVN: r138725

gcc/ada/freeze.adb

index dffcbaf3b403455f33e713c405286bebb58f2c20..5a8f98380a71a2c13c5e7fb50ce89b2b888d5cc8 100644 (file)
@@ -2664,8 +2664,15 @@ package body Freeze is
                --  The check doesn't apply to imported objects, which are not
                --  ever default initialized, and is why the check is deferred
                --  until freezing, at which point we know if Import applies.
+               --  Deferred constants are also exempted from this test because
+               --  their completion is explicit, or through an import pragma.
 
-               if Comes_From_Source (E)
+               if Ekind (E) = E_Constant
+                 and then Present (Full_View (E))
+               then
+                  null;
+
+               elsif Comes_From_Source (E)
                  and then not Is_Imported (E)
                  and then not Has_Init_Expression (Declaration_Node (E))
                  and then