This utility is used in GNATprove to find when a node is inside a named
number declaration, and this case was not properly handled. Now fixed.
There is no impact on compilation.

Tested on x86_64-pc-linux-gnu, committed on trunk

2018-05-23  Yannick Moy  <m...@adacore.com>

gcc/ada/

        * sem_util.adb (Enclosing_Declaration): Fix the case of a named number
        declaration, which was not taken into account.
--- gcc/ada/sem_util.adb
+++ gcc/ada/sem_util.adb
@@ -6635,7 +6635,9 @@ package body Sem_Util is
       while Present (Decl)
         and then not (Nkind (Decl) in N_Declaration
                         or else
-                      Nkind (Decl) in N_Later_Decl_Item)
+                      Nkind (Decl) in N_Later_Decl_Item
+                        or else
+                      Nkind (Decl) = N_Number_Declaration)
       loop
          Decl := Parent (Decl);
       end loop;

Reply via email to