<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - accepts-invalid when a constexpr function is called in a conditional"
   href="https://bugs.llvm.org/show_bug.cgi?id=39242">39242</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>accepts-invalid when a constexpr function is called in a conditional
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++14
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rakuco@FreeBSD.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>constexpr bool always_false() { return false; }
int f() { return 1; }
constexpr int g() {
  if (!always_false()) {}
  return f();
}

The excerpt above fails on GCC and MSVC. clang++ also complains when the
conditional clause is removed:

<source>:3:15: error: constexpr function never produces a constant expression
[-Winvalid-constexpr]
constexpr int g() {
              ^
<source>:5:10: note: non-constexpr function 'f' cannot be used in a constant
expression
  return f();
         ^
<source>:2:5: note: declared here
int f() { return 1; }
    ^</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>