title: Initializing member variables using the same name for constructor arguments as for the member variables allowed by the C++ standard?
body: <p>I figured out that it's possible to initialize the member variables with a constructor argument of the same name as show in the example below.</p>
  
  <pre><code>#include &lt;cstdio&gt;
  #include &lt;vector&gt;
  
  class Blah {
      std::vector&lt;int&gt; vec;
  
  public:
      Blah(std::vector&lt;int&gt; vec): vec(vec)
      {}
  
      void printVec() {
  
          for(unsigned int i=0; i&lt;vec.size(); i++)
              printf("%i ", vec.at(i));
  
          printf("\n");
      }
  };
  
  int main() {
  
      std::vector&lt;int&gt; myVector(3);
  
      myVector.at(0) = 1;
      myVector.at(1) = 2;
      myVector.at(2) = 3;
  
      Blah blah(myVector);
  
      blah.printVec();
  
      return 0;
  }
  </code></pre>
  
  <p>g++ 4.4 with the arguments <code>-Wall -Wextra -pedantic</code> gives no warning and works correctly. It also works with clang++. I wonder what the C++ standard says about it? Is it legal and guaranteed to always work?</p>