title: Why constexpr implicit conversion doesn't always work?
body: <pre><code>#include &lt;iostream&gt;
  
  struct Index {
      constexpr operator int() const { return 666; }
  };
  
  template &lt;int i&gt; void foo() {
      std::cout &lt;&lt; i &lt;&lt; std::endl;
  }
  
  void wrapper(Index index) {
      foo&lt;index&gt;();
  }
  
  int main() {
      Index index;
  //    foo&lt;index&gt;(); // error: the value of ‘index’ is not usable in a constant expression
      wrapper(index);
  }
  </code></pre>
  
  <p>Hello, everyone.</p>
  
  <p>I'm using a constexpr conversion of a variable "index" to an <code>int</code> value, which is substituted to a "foo" templated function.
  If I directly call <code>foo&lt;index&gt;()</code> from "main", I get a compiler error.
  If the same call is done from the "wrapper", then everything compiles and works fine.</p>
  
  <p>What am I missing there?</p>
  
  <p>Compile command: <code>g++ -std=c++14 main.tex</code> with g++ (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6).</p>