[clang] [clang] constexpr built-in abs function. (PR #112539)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 07:19:49 PDT 2024
================
@@ -265,6 +265,15 @@ namespace fpclassify {
char classify_subnorm [__builtin_fpclassify(-1, -1, -1, +1, -1, 1.0e-38f)];
}
+namespace abs {
+ static_assert(__builtin_abs(14) == 14, "");
+ static_assert(__builtin_labs(14L) == 14L, "");
+ static_assert(__builtin_llabs(14LL) == 14LL, "");
+ static_assert(__builtin_abs(-14) == 14, "");
+ static_assert(__builtin_labs(-0x14L) == 0x14L, "");
+ static_assert(__builtin_llabs(-0x141414141414LL) == 0x141414141414LL, "");
+} // namespace abs
+
----------------
cor3ntin wrote:
can you add the same error test cases as in the other files (abs4, etc)
https://github.com/llvm/llvm-project/pull/112539
More information about the cfe-commits
mailing list