title: Could non-static member variable be modified in constexpr constructor (C++14)?
body: <pre><code>struct A {
      int a = 0;
      constexpr A() { a = 1; }
  };
  
  constexpr bool f() {
      constexpr A a;
      static_assert(a.a == 1, ""); // L1: OK
      return a.a == 1;
  }
  static_assert(f(), ""); // L2: Error, can not modify A::a in constexpr
  </code></pre>
  
  <ul>
  <li>Online Compiler URL: <a href="http://goo.gl/jni6Em" rel="nofollow">http://goo.gl/jni6Em</a></li>
  <li>Compiler: clang 3.4 (with -std=c++1y)</li>
  <li>System: Linux 3.2</li>
  </ul>
  
  <p>If I delete L2, this code compiles. If I add L2, the compiler complained "modification of object of const-qualified type 'const int' is not allowed in a constant expression". I am not a language lawyer, so I am not sure whether this is true. However, if it is, why compiler didn't complain anything about L1, since it also called A() as constexpr? Is this a bug of clang? Or did I miss anything?</p>
  
  <p>Reference: <a href="http://en.cppreference.com/w/cpp/language/constexpr" rel="nofollow">http://en.cppreference.com/w/cpp/language/constexpr</a></p>
  
  <p>BTW, if I change "constexpr A a;" to "A a;" (remove constexpr keyword), L1 failed to compile which is expect. However, the compiler didn't complain about L2 anymore.</p>
  
  <p>Online Compiler URL about this: <a href="http://goo.gl/AoTzYx" rel="nofollow">http://goo.gl/AoTzYx</a></p>