https://bugs.llvm.org/show_bug.cgi?id=40216

Richard Smith <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |LATER
             Status|NEW                         |RESOLVED

--- Comment #1 from Richard Smith <[email protected]> ---
This is a GCC bug; ::sqrt and std::sqrt are not constexpr in any C++ standard.
See [cmath.syn] (http://eel.is/c++draft/cmath.syn):

  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
(http://eel.is/c++draft/constexpr.functions#1.sentence-2):

  "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
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0533r3.pdf -- and even
that will not make sqrt constexpr yet.

Resolving LATER: constexpr sqrt (and friends) may well end up being part of
C++23.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to