title: block scope extern declaration
body: <p>The C++11 standard give the code snippet below (I deleted unrelated code) and said the name <code>i</code> have external linkage. (clause 3.5.6) </p>
  
  <pre><code>static int i = 0; // #1
  void g() {
      extern int i; // #3 external linkage
  }
  </code></pre>
  
  <p>Why do they do this? Did I misunderstand something? The two <code>i</code> refer to the same object in vs2012. And when I use <code>i</code> somewhere else, i got an unresolved external error. I have no idea whether vs2012 support this feature or not. </p>
  
  <p>Edit:
  I think VS2012 is doing the right thing. The <code>i</code> in #3 only need to refers to an <code>i</code> that has a linkage. If the compiler can't find one, than the <code>i</code> should be defined in other translation unit. So the two <code>i</code> should refer to the same object in the code snippet above.</p>
  
  <p>The quote from the standard:</p>
  
  <blockquote>
    <p>If there is a visible declaration of an entity with linkage having the
    same name and type, ignoring entities declared outside the innermost
    enclosing namespace scope, the block scope declaration declares that
    same entity and receives the linkage of the previous declaration. if
    no matching entity is found, the block scope entity receives external
    linkage.</p>
  </blockquote>
  
  <p>But why people need this feature?</p>