title: compiler tries to evaluate unreachable code after constexpr if
body: <p>I've experimenting with C++17 lately and found this:</p>
  
  <pre><code>template&lt;size_t i&gt;
  void recurse()
  {
      if constexpr(i == 0)
          return;
      return recurse&lt;i - 1&gt;();
  }
  </code></pre>
  
  <p>Trying to call <code>recurse&lt;4&gt;();</code> will lead to</p>
  
  <p><code>fatal error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum)
           return recurse&lt;i - 1&gt;();</code></p>
  
  <p>Adding an else fixes the error:</p>
  
  <pre><code>template&lt;size_t i&gt;
  void recurse()
  {
      if constexpr(i == 0)
          return;
      else
          return recurse&lt;i - 1&gt;();
  }
  </code></pre>
  
  <p>Is this a bug? Unfortunately I don't have access to another compiler than gcc 7.3.0 right now.</p>