title: constexpr expression and variable lifetime, an example where g++ and clang disagree
body: <p>Consider the simple C++11 code:</p>
  
  <pre><code>template&lt;int N&gt;
  struct Foo {};
  
  template &lt;int N&gt;
  constexpr int size(const Foo&lt;N&gt;&amp;) { return N; }
  
  template &lt;int N&gt;
  void use_size(const Foo&lt;N&gt;&amp; foo) { constexpr int n = size(foo); }
  
  int main()
  {
      Foo&lt;5&gt; foo;
  
      constexpr int x = size(foo);  // works with gcc and clang
                                    // _but_
      use_size(foo);                // the same statement in the use_size() 
                                    // function _only_ works for gcc
  }
  </code></pre>
  
  <p>I can successfuly compile it with <code>g++ -std=c++11 foo.cpp</code></p>
  
  <p>however if I use clang++, <code>clang++ -std=c++11 foo.cpp</code> I get</p>
  
  <pre><code>foo.cpp:15:28: error: constexpr variable 'n' must be initialized by a constant expression
  void use_size(const Foo&lt;N&gt;&amp; foo) { constexpr int n = size(foo); }
                                                       ~~~~~^~~~
  foo.cpp:23:5: note: in instantiation of function template specialization 'use_size&lt;5&gt;' requested here
      use_size(foo);                // the same statement in the use_size() 
      ^
  1 error generated.
  </code></pre>
  
  <p>(nb: compiler versions. I have checked the previous statement with g++ version 5.3.1 and 7.2.1 and with clang++ version 3.6.2 and 5.0.0)</p>
  
  <p><strong>My question:</strong> which of g++ or clang is right? What is the problem?</p>