title: Overload Resolution/Ambiguity in name lookup(which one)
body: <p>$7.3.3/14 (C++03)</p>
  
  <pre><code>struct A { int x(); };
  struct B : A { };
  struct C : A {
     using A::x;
     int x(int);
  };
  struct D : B, C {
     using C::x;
     int x(double);
  };
  int f(D* d) {
     return d-&gt;x(); // ambiguous: B::x or C::x
  }
  </code></pre>
  
  <p>The comment in the code in 'f' indicates that one can expect ambiguity between 'B::x' or 'C::x'.</p>
  
  <p>However, on compiling with g++(ideone) or Comeau the errors are slightly different. These errors instead of indicating ambiguity in B::x or C::x indicate the fact that A is an ambiguous base of D</p>
  
  <blockquote>
    <p>prog.cpp: In function ‘int f(D*)’:
    prog.cpp:16: error: ‘A’ is an
    ambiguous base of ‘D’</p>
  </blockquote>
  
  <p>And </p>
  
  <blockquote>
    <p>"ComeauTest.c", line 21: error: base
    class "A" is ambiguous
         return d->x(); // ambiguous: B::x or C::x</p>
  </blockquote>
  
  <p>Going by the name lookup rules in $10.2, I get a feel that the comment in the code snippet is not really correct. The error is indeed first and foremost related to ambiguity of base class 'A' rather than anything else (e.g. ambiguity in overload resolution). Any thoughts? </p>