Under certain complex circumstances, a LIMITED WITH clause can result in
an incorrect warning that the with'ed item is not referenced, when in fact
it is referenced. No simple test is available.

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

2015-01-07  Robert Dewar  <de...@adacore.com>

        * sem_warn.adb (Check_One_Unit): Guard against context item
        with no Entity field.

Index: sem_warn.adb
===================================================================
--- sem_warn.adb        (revision 219191)
+++ sem_warn.adb        (working copy)
@@ -2350,6 +2350,13 @@
             if Nkind (Item) = N_With_Clause
               and then not Implicit_With (Item)
               and then In_Extended_Main_Source_Unit (Item)
+
+              --  Guard for no entity present. Not clear under what conditions
+              --  this happens, but it does occur, and since this is only a
+              --  warning, we just suppress the warning in this case.
+
+              and then Nkind (Name (Item)) in N_Has_Entity
+              and then Present (Entity (Name (Item)))
             then
                Lunit := Entity (Name (Item));
 

Reply via email to