title: Constant integers and constant evaluation
body: <p>Consider the following program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;type_traits&gt;
  
  constexpr int f() {
    if (std::is_constant_evaluated())
      return -1;
    else return 1;
  }
  
  int main() {
    int const i = f();
    std::cout &lt;&lt; i;
  }
  </code></pre>
  
  <p>It <a href="https://wandbox.org/permlink/MKfrdFZkAqXVQ2CJ" rel="noreferrer">prints <code>-1</code> when run</a> (wandbox).</p>
  
  <p>However, if I make the function <code>throw</code> when evaluated at compile time::</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;type_traits&gt;
  
  constexpr int f() {
    if (std::is_constant_evaluated())
      throw -1; // &lt;----------------------- Changed line
    else return 1;
  }
  
  int main() {
    int const i = f();
    std::cout &lt;&lt; i;
  }
  </code></pre>
  
  <p>it <a href="https://wandbox.org/permlink/8HnS4EXTLwhDd8xw" rel="noreferrer">compiles fine and outputs 1</a> (wandbox). Why didn't I get a compile failure instead?</p>