title: Ambiguous injected class name is not an error
body: <p>What I read in the C++ standard about injected class names contradicts (as I see it) with the behavior of a sample program I will present shortly. Here's what I read:</p>
  
  <ul>
  <li><p>From 3.4 (paragraph 3)</p>
  
  <blockquote>
    <p>The injected-class-name of a class (clause 9) is also considered to be
    a member of that class for the purposes of name hiding and lookup.</p>
  </blockquote></li>
  <li><p>From 9 (paragraph 2)</p>
  
  <blockquote>
    <p>A class-name is inserted into the scope in which it is declared
    immediately after the class-name is seen. The class-name is also
    inserted into the scope of the class itself; this is known as the
    injected-class-name. For purposes of access checking, the
    injected-class-name is treated as if it were a public member name.</p>
  </blockquote></li>
  </ul>
  
  <p>From these I understand that the following is a well-formed translation unit and it compiles successfully.</p>
  
  <pre><code>#include &lt;vector&gt;
  class X: std::vector&lt;int&gt;
  {
     vector mem;
  };
  </code></pre>
  
  <p>However, I would suppose that the following should have produced an error, but it doesn't</p>
  
  <pre><code>#include &lt;vector&gt;
  class X: std::vector&lt;int&gt;, std::vector&lt;char&gt;
  {
     vector mem; //compiles OK... mem is apparently std::vector&lt;int&gt;
  };
  </code></pre>
  
  <p>Since the name <code>vector</code> is injected into both <code>std::vector&lt;int&gt;</code> and <code>std::vector&lt;char&gt;</code> as as if a public member name, then it should be inherited by X and therefore the name <code>vector</code> in <code>X</code> should be ambiguous. Am I missing something?</p>
  
  <p>P.S. I am using MSVC9.0</p>