title: what is the expected behavior?
body: <p>Below is a purely academically invented class hierarchy.</p>
  
  <pre><code>struct X{
          void f1();
          void f2();
          void f3();
  };
  
  struct Y : private X{
          void f4();
  };
  
  struct Z : X{
  };
  
  struct D : Y, Z{
          using X::f2;
          using Z::X::f3;
  };
  
  int main(){}
  </code></pre>
  
  <p>I expected using declaration for X::f2 to be ambiguous as 'X' is an ambiguous base of 'D' (visbility vs accessibility of X). However g++ (ideone.com) compiles it fine.</p>
  
  <p>I checked with Online Comeau and it gives error in using declaration for X::f2 as expected. However it gives ambiguity for using declaration for Z::X::f3 as well.</p>
  
  <p>So what is the expected behavior?</p>
  
  <p><strong>Edit 1:</strong> </p>
  
  <p>A reference to the appropriate section of the Standard would be helpful, please.</p>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>I checked with VS 2010 and it has objections only with the using declaration X::f2. However it is not about ambiguity of 'X' (as in the case of gcc and Comeau). It is about "error C2876: 'X' : not all overloads are accessible".</p>
  
  <p><strong>Edit 3:</strong></p>
  
  <pre><code>struct X{
      void f(){}
  };
  
  struct Y : X{
      struct trouble{
          void f(){}
      };
  
  };
  
  struct trouble : X{
  };
  
  struct letscheck : Y, trouble{
      using trouble::f;
  };
  
  int main(){}
  </code></pre>
  
  <p>Here I have attempted (purposefully) to create an issue with types in using declaration. Gcc still compiles this fine and so does VS2010. Comeau still gives error (as expected) about ambiguous types 'trouble'. Going by explanations given for the initial queries, it appears GCC and VS2010 are wrong. Is that correct?</p>