A prefixed call is resolved by examining the dispatch table of the controlling object, not by visibility. The operation may be defined in another unit, and no reference to it, or to its scope, might be created for it through the usual Generate_Reference machinery. To prevent spurious warnings about unused units, indicate that the operation and its scope are in fact referenced.
No simple example available. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-23 Ed Schonberg <schonb...@adacore.com> * sem_ch4.adb (Complete_Object_Operation): Indicate that the scope of the operation (s) is referenced, to prevent spurious warnings about unused units.
Index: sem_ch4.adb =================================================================== --- sem_ch4.adb (revision 216574) +++ sem_ch4.adb (working copy) @@ -7617,6 +7617,17 @@ Rewrite (First_Actual, Obj); end if; + -- The operation is obtained from the dispatch table and not by + -- visibility, and may be declared in a unit that is not explicitly + -- referenced in the source, but is nevertheless required in the + -- context of the current unit. Indicate that operation and its scope + -- are referenced, to prevent spurious and misleading warnings. If + -- the operation is overloaded, all primitives are in the same scope + -- and we can use any of them. + + Set_Referenced (Entity (Subprog), True); + Set_Referenced (Scope (Entity (Subprog)), True); + Rewrite (Node_To_Replace, Call_Node); -- Propagate the interpretations collected in subprog to the new