title: Inner member visibility in class
body: <p>According to the C++ standard, </p>
  
  <blockquote>
    <p><strong>9.2 [class.mem]:</strong></p>
    
    <p>A class is considered a completely-defined object type (3.9) (or
    complete type) at the closing } of the class-specifier. Within the
    class member-specification, the class is regarded as complete within
    function bodies, default arguments, using-declarations introducing
    inheriting constructors (12.9), exception-specifications, and
    brace-or-equal-initializers for non-static data members (including
    such things in nested classes). Otherwise it is regarded as incomplete
    within its own class member-specification</p>
  </blockquote>
  
  <p>So, the code below should compile, and indeed it does</p>
  
  <pre><code>struct Foo{
       Foo()
       {
          Bar bar; // Bar is fully visible here, even though it's defined later
       }
       //void f(Bar){} // But NOT VISIBLE if used as a function parameter
       struct Bar{};
  };
  
  int main()
  {
      Foo foo;
  }
  </code></pre>
  
  <p><a href="http://coliru.stacked-crooked.com/a/7dd47ebf3b78c9b7"><kbd>Live on Coliru</kbd></a></p>
  
  <p>However, if I uncomment the line that defines the member function <code>void Foo::f(Bar)</code>, then the code fails to compile with the error</p>
  
  <blockquote>
    <p>error: 'Bar' has not been declared</p>
  </blockquote>
  
  <p>Reading again the standard it indeed seems that function parameters are not considered as places where the class is regarded as complete. However, it does not make any sense at all. Can you shed some light why I cannot use <code>Bar</code> in a function parameter (but otherwise can fully use it <strong>inside</strong> a function without any issues whatsoever) before its full definition?</p>