<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED LATER - sqrt not considered constexpr"
   href="https://bugs.llvm.org/show_bug.cgi?id=40216">bug 40216</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>LATER
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED LATER - sqrt not considered constexpr"
   href="https://bugs.llvm.org/show_bug.cgi?id=40216#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED LATER - sqrt not considered constexpr"
   href="https://bugs.llvm.org/show_bug.cgi?id=40216">bug 40216</a>
              from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
        <pre>This is a GCC bug; ::sqrt and std::sqrt are not constexpr in any C++ standard.
See [cmath.syn] (<a href="http://eel.is/c++draft/cmath.syn">http://eel.is/c++draft/cmath.syn</a>):

  float sqrt(float x);  // see [library.c]
  double sqrt(double x);
  long double sqrt(long double x);  // see [library.c]
  float sqrtf(float x);
  long double sqrtl(long double x);

... and also [constexpr.functions]/1
(<a href="http://eel.is/c++draft/constexpr.functions#1.sentence-2">http://eel.is/c++draft/constexpr.functions#1.sentence-2</a>):

  "An implementation shall not declare any standard library function signature
as constexpr except for those where it is explicitly required."

... which means we are not even permitted to treat sqrt as constexpr as an
extension (which is why this is a GCC bug rather than a GCC extension).

The latest work towards making some of <cmath> constexpr is
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0533r3.pdf">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0533r3.pdf</a> -- and even
that will not make sqrt constexpr yet.

Resolving LATER: constexpr sqrt (and friends) may well end up being part of
C++23.</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>