An interesting case of name resolution

Consider this:

procedure Visibility is
   package Q is
      type T is abstract tagged null record;
      function "&" (Left, Right : T) return T is abstract;
      function "&" (Left, Right : Integer) return T  is abstract;
   end Q;
   package R is
      use Q;
      type S is new T with null record;
   private
      overriding function "&" (Left, Right : S) return S;
      overriding function "&" (Left, Right : Integer) return S;
   end R;
   package body R is -- The body is irrelevant
      function "&" (Left, Right : S) return S is
      begin
         return S'(null record);
      end "&";
      function "&" (Left, Right : Integer) return S is
      begin
         return S'(null record);
      end "&";
   end R;
   use R;
   X : Q.T'Class := (1 & 2) & (3 & 4); -- This is fine
begin
   null;
end Visibility;

Now, let’s change it to this (just adding use Q):

   use Q, R;
   X : T'Class := (1 & 2) & (3 & 4); -- Error!

GNAT 16.2 gives:

visibility.adb:25:27: error: ambiguous expression (cannot resolve "&")
visibility.adb:25:27: error: possible interpretation (inherited) at line 9
visibility.adb:25:27: error: possible interpretation at line 4
gnatmake: "visibility.adb" compilation error

It seems that an abstract primitive function (line 4) gets considered in resolution of “&”! This is quite surprizing to me, but I do not know if the compiler is correct here.

use Q, R;
X : T’Class := R.S’(1 & 2) & (3 & 4); – OK again

I’m sorry, but I also cannot tell whether GNAT is right in rejecting the code.
It might have to do with dispatching, calling abstract operations must be dispatching, but here there is no dispatching.

  use Q, R;
  Y1: Q.T'Class := R.S'(1 & 2);
  Y2: Q.T'Class := R.S'(3 & 4);
  --Z : Q.T'Class := Y1 & (3 & 4);  --visibility.adb:48:27: error: call to abstract function must be dispatching
--                           | col 27
  Z : Q.T'Class := Y1 & Y2;  -- now dispatching and OK