title: Trying to understand [class.qual]/2 in the C++ Standard
body: <p>According to the answers I obtained <a href="https://stackoverflow.com/q/33842988/1042389">here</a>, the code below is ill-formed, notwithstanding the fact that <code>clang</code> and <code>vs2015</code> accept it.</p>
  
  <pre><code>#include &lt;iostream&gt;
  class A {
  public:
      A() { std::cout &lt;&lt; "A()" &lt;&lt; '\n'; }
  };
  
  int main()
  {
    A::A();
  }
  </code></pre>
  
  <p>Nevertheless the code below appears to work in all 3 compilers (see <a href="http://coliru.stacked-crooked.com/a/3cf42b75b19560ca" rel="nofollow noreferrer">live example</a>). AFAICT, according to [class.qual/2] the code is ill-formed. Or am I missing something here?</p>
  
  <pre><code>#include &lt;iostream&gt;
  struct B { B() { std::cout &lt;&lt; "B()" &lt;&lt; '\n'; } };
  struct A : public B { };
  int main()
  {
      A::B();
  }
  </code></pre>
  
  <p>Also, according to [class.qual]/2, the code below is well-formed and in this case, all 3 compilers produce the expected output (see example <a href="http://coliru.stacked-crooked.com/a/1fa3ba388d154ddc" rel="nofollow noreferrer">here</a>).</p>
  
  <pre><code>include &lt;iostream&gt;
  struct B { B() { std::cout &lt;&lt; "B()" &lt;&lt; '\n'; } };
  struct A : public B { using B::B; A() { std::cout &lt;&lt; "A()" &lt;&lt; '\n'; }  void f() { B(); } };
  int main()
  {
      A a;
      a.f();
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>B()
  A()
  B()
  </code></pre>
  
  <p>But I'd like to know what is the usefulness of a <em>using-declaration</em> naming a constructor, as the one (<code>using B::B;</code>) in class <code>A</code> above. Note that this <em>using-declaration</em> is totally irrelevant in this case, no matter whether <code>B</code> is a base class of <code>A</code>, or not.  </p>