title: Is my interpretation of the word 'first' in §3.3.2/6 correct?
body: <p>In the snippet below I can understand (from §3.3.2/6 second bullet point) that the name <code>B</code> in the declaration <code>struct B* p;</code> is injected into the global namespace as a <em>class-name</em>.</p>
  
  <pre><code>struct A {
   //   struct B{};
      int B;
      struct B* p;
  };
  
  void f(B&amp;) {}
  
  int main()
  {
      A a;
      f(*a.p);
  }
  </code></pre>
  
  <p>§3.3.2/6:</p>
  
  <blockquote>
    <p>The point of declaration of a class <strong>first</strong> declared in an
    <em>elaborated-type-specifier</em> is as follows:</p>
    
    <ul>
    <li><p>for a declaration of the form</p>
    
    <p><em>class-key</em> <em>attribute-specifier-seq</em> <em>opt</em> <em>identifier</em>;</p>
    
    <p>the <em>identifier</em> is declared to be a <em>class-name</em> in the scope that
    contains the declaration, otherwise</p></li>
    <li><p>for an <em>elaborated-type-specifier</em> of the form</p>
    
    <p><em>class-key</em> <em>identifier</em></p>
    
    <p>if the <em>elaborated-type-specifier</em> is used in the <em>decl-specifier-seq</em> or <em>parameter-declaration-clause</em> of a function defined in namespace scope, the <em>identifier</em> is declared as a
    <em>class-name</em> in the namespace that contains the declaration; otherwise, except as a <em>friend</em> declaration, the <em>identifier</em> is
    declared in the smallest namespace or block scope that contains the
    declaration. [ <em>Note</em>: These rules also apply within templates. — <em>end
    note</em> ] [ <em>Note</em>: Other forms of <em>elaborated-type-specifier</em> do not
    declare a new name, and therefore must refer to an existing type-name.
    See 3.4.4 and 7.1.6.3. — <em>end note</em> ]</p></li>
    </ul>
  </blockquote>
  
  <p>However if I uncomment the definition of <code>struct B{};</code> inside <code>struct A</code>, what I said earlier with regard to the injection of name <code>B</code> into the global namespace, doesn't occur anymore, as the code doesn't compile. I believe this has to do with the word <strong>first</strong> (emphasis mine) above, since now the <em>class-name</em> <code>B</code>, in the declaration <code>struct B* p;</code> is no more its first declaration <strong>in its declarative region</strong>. Am I correct saying this?</p>
  
  <p>Assuming my interpretation is correct, why is it that the <em>class-name</em> <code>B</code> is not injected in the global namespace in this case? Note that the nested class <code>struct B{};</code> will be hidden inside A in this case, i.e., even if we change the declaration of function <code>f</code> to <code>void f(A::B&amp;)</code> the code won't compile. </p>
  
  <p>There is still one other point that isn't clear to me: what made the implementers to decide for the class-name injection into the namespace, or block scope, containing the elaborated-type-specifier, in the second bullet point above? That is, why didn't they leave the class-name declaration inside the class scope?</p>