title: Definition of the same class in the different TUs
body: <p>I have a program linking of two different TUs as follows:</p>
  
  <p>main.cpp</p>
  
  <pre><code>int a = 6;
  
  struct A
  {
      int b = a;
  };
  
  int main(){ }
  </code></pre>
  
  <p>slave.cpp</p>
  
  <pre><code>static int a = 42;
  
  struct A
  {
      int b = a;
  };
  </code></pre>
  
  <p>I expect that linker will throw an error in that case, beacuse (<code>N3797::3.2/6</code> [basic.def.odr]):</p>
  
  <blockquote>
    <p>There can be more than one definition of a class type [...]</p>
    
    <p>Given such an entity named D defined in more than one translation
    unit, then </p>
    
    <p>[...] </p>
    
    <p>— in each definition of D, corresponding names,
    looked up according to 3.4, shall refer to an entity defined within
    the definition of D, or shall refer to the same entity, after overload
    resolution (13.3) and after matching of partial template
    specialization (14.8.3), except that a name can refer to a
    non-volatile const object with internal or no linkage if the object
    has the same literal type in all definitions of D, and the object is
    initialized with a constant expression (5.19), and the object is not
    odr-used, and the object has the same value in all definitions of D;</p>
    
    <p>[...]</p>
  </blockquote>
  
  <p>So in my case <code>a</code> refers to the different entity in the different TUs, therefore it shouldn't be linked correctly. But in my case it does. I'm using <code>gcc -o bin main.o slave.o</code> with <code>gcc 4.7.2-2ubuntu1</code>. Is it a bug?</p>