In ASIS mode we resolve the expressions in aspect specifications to provide
sufficient semantic information, including entities and types of identifiers.
The tree traversal that performs this resolution must omit identifiers that
are selector names of parameter associations in calls, because these do not
carry entity information.

The following must compile quietly:

   gcc -c -gnatct check.adb

   package Check is
      function String_OK (Name : String) return Boolean;
      type  S1 is new String with Dynamic_Predicate =>
        String_OK (Name => String (S1));
   end Check;
---
   package body Check is
      function String_OK (Name : String) return Boolean is
      begin
         return True;
      end;
   end Check;

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

2017-09-25  Ed Schonberg  <schonb...@adacore.com>

        * sem_ch13.adb (Resolve_Aspect_Expressions): Do not resolve identifiers
        that appear as selector names of parameter associations, as these are
        never resolved by visibility.

Index: sem_ch13.adb
===================================================================
--- sem_ch13.adb        (revision 253135)
+++ sem_ch13.adb        (working copy)
@@ -12797,7 +12797,14 @@
 
             return Skip;
 
-         elsif Nkind (N) = N_Identifier and then Chars (N) /= Chars (E) then
+         --  Resolve identifiers that are not selectors in parameter
+         --  associations (these are never resolved by visibility).
+
+         elsif Nkind (N) = N_Identifier
+           and then Chars (N) /= Chars (E)
+           and then (Nkind (Parent (N)) /= N_Parameter_Association
+                      or else N /= Selector_Name (Parent (N)))
+         then
             Find_Direct_Name (N);
 
             --  In ASIS mode we must analyze overloaded identifiers to ensure

Reply via email to