]> gcc.gnu.org Git - gcc.git/commitdiff
[Ada] Fix detection of deferred constants for freezing error
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 12 May 2022 15:44:59 +0000 (17:44 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 2 Jun 2022 09:06:40 +0000 (09:06 +0000)
Testing Is_Frozen is not robust enough, so instead test that the full view
has been seen and that the Has_Completion flag is set on it.

gcc/ada/

* freeze.adb (Check_Expression_Function.Find_Constant): Make test
for deferred constants more robust.

gcc/ada/freeze.adb

index f4ebf300a19fbdee98aff9ccc7d9447bdfa64a66..b7310a4e8a84190ca1e07fd35bbc93a8f3ae7283 100644 (file)
@@ -1458,7 +1458,8 @@ package body Freeze is
                                                          N_Object_Declaration
            and then not Is_Imported (Entity (Nod))
            and then not Has_Completion (Entity (Nod))
-           and then not Is_Frozen (Entity (Nod))
+           and then not (Present (Full_View (Entity (Nod)))
+                          and then Has_Completion (Full_View (Entity (Nod))))
          then
             Error_Msg_NE
               ("premature use of& in call or instance", N, Entity (Nod));
This page took 0.068846 seconds and 5 git commands to generate.