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: unassignedclangb...@nondot.org
          Reporter: darrell.wri...@gmail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

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
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to