title: Strange behavior with constexpr static member variable
body: <p>This is a follow up question to <a href="https://stackoverflow.com/questions/28530278/undefined-reference-to-static-constexpr-char">Undefined reference to static constexpr char[][]</a>.</p>
  
  <p>The following program builds and runs fine.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  struct A {
     constexpr static char dict[] = "test";
  
     void print() {
        std::cout &lt;&lt; A::dict[0] &lt;&lt; std::endl;
     }
  };
  
  int main() {
     A a;
     a.print();
     return 0;
  }
  </code></pre>
  
  <p>However, if I change <code>A::print()</code> to:</p>
  
  <pre><code>   void print() {
        std::cout &lt;&lt; A::dict &lt;&lt; std::endl;
     }
  </code></pre>
  
  <p>I get the following linker error in g++ 4.8.2.</p>
  
  <pre>
  /tmp/cczmF84A.o: In function `A::print()':
  socc.cc:(.text._ZN1A5printEv[_ZN1A5printEv]+0xd): undefined reference to `A::dict'
  collect2: error: ld returned 1 exit status
  </pre>
  
  <p>The linker error can be resolved by adding a line:</p>
  
  <pre><code>constexpr char A::dict[];
  </code></pre>
  
  <p>outside the class definition. </p>
  
  <p>However, it's not clear to me why using one of the members of the array does not cause a linker error while using the array causes a linker error.</p>