[clang] [C++23] [CLANG] Adding C++23 constexpr math functions: fmin and frexp. (PR #88978)
Hubert Tong via cfe-commits
cfe-commits at lists.llvm.org
Sat May 4 20:50:39 PDT 2024
================
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -DWIN -verify -std=c++23 -fsyntax-only %s
+// RUN: %clang_cc1 -verify -std=c++23 -fsyntax-only %s
+
+// expected-no-diagnostics
+
+
+#ifdef WIN
+#define INFINITY ((float)(1e+300 * 1e+300))
+#define NAN (-(float)(INFINITY * 0.0F))
+#else
+#define NAN (__builtin_nanf(""))
+#define INFINITY (__builtin_inff())
+#endif
+
+int main() {
----------------
hubert-reinterpretcast wrote:
Use identity instead of comparisons/classifications for validation:
```suggestion
template <auto, auto> constexpr bool is_same_val = false;
template <auto X> constexpr bool is_same_val<X, X> = true;
int main() {
```
https://github.com/llvm/llvm-project/pull/88978
More information about the cfe-commits
mailing list