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

            Bug ID: 40324
           Summary: floating point NaN generation isn't considered a
                    constant expression
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

The following code isn't considered constexpr in clang/apple clang but does
work in gcc.  I could not find anything in the standard(not an exhaustive look)
that indicated that this would not be allowed in a constant expression.  The
worry is that if this is correct I would have to create code to ensure it
cannot happen.  I tried trunk and latest Apple Clang with 11,14,17, and 2a
standards as arguments.

#include <limits>
constexpr bool cx() {
  return std::numeric_limits<double>::infinity() -
         std::numeric_limits<double>::infinity();
}
static_assert(cx(), "");

https://gcc.godbolt.org/z/DxFd2F

-- 
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