[libcxx-commits] [libcxx] [libc++][numeric][NFC] Cleanup *Saturation arithmetic* tests (PR #101826)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Aug 3 07:31:31 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Hristo Hristov (H-G-Hristov)
<details>
<summary>Changes</summary>
This simplifies the tests a little bit:
Fixed -> TODO(LLVM20): remove [[maybe_unused]] and `{}` scope since all supported compilers support "Placeholder variables with no name"
*IMPORTANT: To be merged after CI drop LLVM17 support.*
---
Patch is 32.77 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/101826.diff
5 Files Affected:
- (modified) libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp (+2-4)
- (modified) libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp (+2-4)
- (modified) libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp (+2-4)
- (modified) libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp (+64-67)
- (modified) libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/sub_sat.pass.cpp (+2-4)
``````````diff
diff --git a/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp b/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
index 036bf53e36dcd..8288378ab769e 100644
--- a/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/add_sat.pass.cpp
@@ -25,8 +25,7 @@ constexpr bool test_signed() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();
- // TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
- [[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::add_sat(minVal, maxVal);
+ std::same_as<IntegerT> decltype(auto) _ = std::add_sat(minVal, maxVal);
static_assert(noexcept(std::add_sat(minVal, maxVal)));
@@ -97,8 +96,7 @@ constexpr bool test_unsigned() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();
- // TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
- [[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::add_sat(minVal, maxVal);
+ std::same_as<IntegerT> decltype(auto) _ = std::add_sat(minVal, maxVal);
static_assert(noexcept(std::add_sat(minVal, maxVal)));
diff --git a/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp b/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
index b1cace74d8828..fa9841b24d27a 100644
--- a/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/div_sat.pass.cpp
@@ -26,8 +26,7 @@ constexpr bool test_signed() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();
- // TODO(LLVM-20) remove [[maybe_unused]] and `{}` scope since all supported compilers support "Placeholder variables with no name"
- [[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::div_sat(minVal, maxVal);
+ std::same_as<IntegerT> decltype(auto) _ = std::div_sat(minVal, maxVal);
static_assert(noexcept(std::div_sat(minVal, maxVal)));
@@ -89,8 +88,7 @@ constexpr bool test_unsigned() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();
- // TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
- [[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::div_sat(minVal, maxVal);
+ std::same_as<IntegerT> decltype(auto) _ = std::div_sat(minVal, maxVal);
static_assert(noexcept(std::div_sat(minVal, maxVal)));
// clang-format off
diff --git a/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp b/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
index 2c8eec57e1204..060eb52103a02 100644
--- a/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/mul_sat.pass.cpp
@@ -26,8 +26,7 @@ constexpr bool test_signed() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();
- // TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
- [[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::mul_sat(minVal, maxVal);
+ std::same_as<IntegerT> decltype(auto) _ = std::mul_sat(minVal, maxVal);
static_assert(noexcept(std::mul_sat(minVal, maxVal)));
@@ -103,8 +102,7 @@ constexpr bool test_unsigned() {
constexpr auto minVal = std::numeric_limits<IntegerT>::min();
constexpr auto maxVal = std::numeric_limits<IntegerT>::max();
- // TODO(LLVM-20) remove [[maybe_unused]] since all supported compilers support "Placeholder variables with no name"
- [[maybe_unused]] std::same_as<IntegerT> decltype(auto) _ = std::mul_sat(minVal, maxVal);
+ std::same_as<IntegerT> decltype(auto) _ = std::mul_sat(minVal, maxVal);
static_assert(noexcept(std::mul_sat(minVal, maxVal)));
diff --git a/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp b/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
index cbca37e3a6613..4ba27d6636894 100644
--- a/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturate_cast.pass.cpp
@@ -20,7 +20,6 @@
#include <numeric>
#include "test_macros.h"
-#include <print>
// Smaller to larger
static_assert(noexcept(std::saturate_cast<signed int>(std::numeric_limits<signed char>::max())));
@@ -72,314 +71,312 @@ constexpr bool test() {
// signed char
- // TODO(LLVM-20) remove [[maybe_unused]] and `{}` scope since all supported compilers support "Placeholder variables with no name",
- // here and below...
- { [[maybe_unused]] std::same_as<signed char> decltype(auto) _ = std::saturate_cast<signed char>(SCHAR_MAX); }
+ std::same_as<signed char> decltype(auto) _ = std::saturate_cast<signed char>(SCHAR_MAX);
assert(std::saturate_cast<signed char>(SCHAR_MIN) == SCHAR_MIN);
assert(std::saturate_cast<signed char>( O_C) == O_C);
assert(std::saturate_cast<signed char>(SCHAR_MAX) == SCHAR_MAX);
- { [[maybe_unused]] std::same_as<signed char> decltype(auto) _ = std::saturate_cast<signed char>(UCHAR_MAX); }
+ std::same_as<signed char> decltype(auto) _ = std::saturate_cast<signed char>(UCHAR_MAX);
assert(std::saturate_cast<signed char>( O_UC) == O_C);
assert(std::saturate_cast<signed char>(UCHAR_MAX) == SCHAR_MAX);
- { [[maybe_unused]] std::same_as<signed char> decltype(auto) _ = std::saturate_cast<signed char>(sBigMax); }
+ std::same_as<signed char> decltype(auto) _ = std::saturate_cast<signed char>(sBigMax);
assert(std::saturate_cast<signed char>(sBigMin) == SCHAR_MIN); // saturated
assert(std::saturate_cast<signed char>( sZero) == O_C);
assert(std::saturate_cast<signed char>(sBigMax) == SCHAR_MAX); // saturated
- { [[maybe_unused]] std::same_as<signed char> decltype(auto) _ = std::saturate_cast<signed char>(uBigMax); }
+ std::same_as<signed char> decltype(auto) _ = std::saturate_cast<signed char>(uBigMax);
assert(std::saturate_cast<signed char>( uZero) == O_C);
assert(std::saturate_cast<signed char>(uBigMax) == SCHAR_MAX); // saturated
// short
- { [[maybe_unused]] std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(SCHAR_MAX); }
+ std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(SCHAR_MAX);
assert(std::saturate_cast<signed short int>(SCHAR_MIN) == static_cast<signed short int>(SCHAR_MIN));
assert(std::saturate_cast<signed short int>( O_C) == O_S);
assert(std::saturate_cast<signed short int>(SCHAR_MAX) == static_cast<signed short int>(SCHAR_MAX));
- { [[maybe_unused]] std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(UCHAR_MAX); }
+ std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(UCHAR_MAX);
assert(std::saturate_cast<signed short int>( O_UC) == O_S);
assert(std::saturate_cast<signed short int>(UCHAR_MAX) == static_cast<signed short int>(UCHAR_MAX));
- { [[maybe_unused]] std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(SHRT_MAX); }
+ std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(SHRT_MAX);
assert(std::saturate_cast<signed short int>( SHRT_MIN) == SHRT_MIN);
assert(std::saturate_cast<signed short int>( O_S) == O_S);
assert(std::saturate_cast<signed short int>( SHRT_MAX) == SHRT_MAX);
- { [[maybe_unused]] std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(USHRT_MAX); }
+ std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(USHRT_MAX);
assert(std::saturate_cast<signed short int>( O_US) == O_S);
assert(std::saturate_cast<signed short int>(USHRT_MAX) == SHRT_MAX); // saturated
- { [[maybe_unused]] std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(sBigMax); }
+ std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(sBigMax);
assert(std::saturate_cast<signed short int>( sBigMin) == SHRT_MIN); // saturated
assert(std::saturate_cast<signed short int>( sZero) == O_S);
assert(std::saturate_cast<signed short int>( sBigMax) == SHRT_MAX); // saturated
- { [[maybe_unused]] std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(uBigMax); }
+ std::same_as<signed short int> decltype(auto) _ = std::saturate_cast<signed short int>(uBigMax);
assert(std::saturate_cast<signed short int>( uZero) == O_S);
assert(std::saturate_cast<signed short int>( uBigMax) == SHRT_MAX); // saturated
// int
- { [[maybe_unused]] std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(SCHAR_MAX); }
+ std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(SCHAR_MAX);
assert(std::saturate_cast<signed int>(SCHAR_MIN) == static_cast<signed int>(SCHAR_MIN));
assert(std::saturate_cast<signed int>( O_C) == 0);
assert(std::saturate_cast<signed int>(SCHAR_MAX) == static_cast<signed int>(SCHAR_MAX));
- { [[maybe_unused]] std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(UCHAR_MAX); }
+ std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(UCHAR_MAX);
assert(std::saturate_cast<signed int>( O_UC) == 0);
assert(std::saturate_cast<signed int>(UCHAR_MAX) == static_cast<signed int>(UCHAR_MAX));
- { [[maybe_unused]] std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(INT_MAX); }
+ std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(INT_MAX);
assert(std::saturate_cast<signed int>( INT_MIN) == INT_MIN);
assert(std::saturate_cast<signed int>( 0) == 0);
assert(std::saturate_cast<signed int>( INT_MAX) == INT_MAX);
- { [[maybe_unused]] std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(UINT_MAX); }
+ std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(UINT_MAX);
assert(std::saturate_cast<signed int>( 0) == 0);
assert(std::saturate_cast<signed int>(UINT_MAX) == INT_MAX); // saturated
- { [[maybe_unused]] std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(sBigMax); }
+ std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(sBigMax);
assert(std::saturate_cast<signed int>( sBigMin) == INT_MIN); // saturated
assert(std::saturate_cast<signed int>( sZero) == 0);
assert(std::saturate_cast<signed int>( sBigMax) == INT_MAX); // saturated
- { [[maybe_unused]] std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(uBigMax); }
+ std::same_as<signed int> decltype(auto) _ = std::saturate_cast<signed int>(uBigMax);
assert(std::saturate_cast<signed int>( uZero) == 0);
assert(std::saturate_cast<signed int>( uBigMax) == INT_MAX); // saturated
// long
- { [[maybe_unused]] std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(SCHAR_MAX); }
+ std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(SCHAR_MAX);
assert(std::saturate_cast<signed long int>(SCHAR_MIN) == static_cast<signed long int>(SCHAR_MIN));
assert(std::saturate_cast<signed long int>( O_C) == 0L);
assert(std::saturate_cast<signed long int>(SCHAR_MAX) == static_cast<signed long int>(SCHAR_MAX));
- { [[maybe_unused]] std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(UCHAR_MAX); }
+ std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(UCHAR_MAX);
assert(std::saturate_cast<signed long int>( O_UC) == 0L);
assert(std::saturate_cast<signed long int>(UCHAR_MAX) == static_cast<signed long int>(UCHAR_MAX));
- { [[maybe_unused]] std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(LONG_MAX); }
+ std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(LONG_MAX);
assert(std::saturate_cast<signed long int>( LONG_MIN) == LONG_MIN);
assert(std::saturate_cast<signed long int>( 0L) == 0L);
assert(std::saturate_cast<signed long int>( LONG_MAX) == LONG_MAX);
- { [[maybe_unused]] std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(ULONG_MAX); }
+ std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(ULONG_MAX);
assert(std::saturate_cast<signed long int>( 0UL) == 0L);
assert(std::saturate_cast<signed long int>(ULONG_MAX) == LONG_MAX); // saturated
- { [[maybe_unused]] std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(sBigMax); }
+ std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(sBigMax);
assert(std::saturate_cast<signed long int>( sBigMin) == LONG_MIN); // saturated
assert(std::saturate_cast<signed long int>( sZero) == 0L);
assert(std::saturate_cast<signed long int>( sBigMax) == LONG_MAX); // saturated
- { [[maybe_unused]] std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(uBigMax); }
+ std::same_as<signed long int> decltype(auto) _ = std::saturate_cast<signed long int>(uBigMax);
assert(std::saturate_cast<signed long int>( uZero) == 0L);
assert(std::saturate_cast<signed long int>( uBigMax) == LONG_MAX); // saturated
// long long
- { [[maybe_unused]] std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(SCHAR_MAX); }
+ std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(SCHAR_MAX);
assert(std::saturate_cast<signed long long int>(SCHAR_MIN) == static_cast<signed long long int>(SCHAR_MIN));
assert(std::saturate_cast<signed long long int>( 0LL) == 0LL);
assert(std::saturate_cast<signed long long int>(SCHAR_MAX) == static_cast<signed long long int>(SCHAR_MAX));
- { [[maybe_unused]] std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(UCHAR_MAX); }
+ std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(UCHAR_MAX);
assert(std::saturate_cast<signed long long int>( O_UC) == 0LL);
assert(std::saturate_cast<signed long long int>(UCHAR_MAX) == static_cast<signed long long int>(UCHAR_MAX));
- { [[maybe_unused]] std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(LLONG_MIN); }
+ std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(LLONG_MIN);
assert(std::saturate_cast<signed long long int>(LLONG_MIN) == LLONG_MIN);
assert(std::saturate_cast<signed long long int>( 0LL) == 0LL);
assert(std::saturate_cast<signed long long int>(LLONG_MAX) == LLONG_MAX);
- { [[maybe_unused]] std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(ULLONG_MAX); }
+ std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(ULLONG_MAX);
assert(std::saturate_cast<signed long long int>( 0ULL) == 0LL);
assert(std::saturate_cast<signed long long int>(ULLONG_MAX) == LLONG_MAX); // saturated
#ifndef TEST_HAS_NO_INT128
- { [[maybe_unused]] std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(sBigMax); }
+ std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(sBigMax);
assert(std::saturate_cast<signed long long int>( sBigMin) == LLONG_MIN); // (128-bit) saturated
assert(std::saturate_cast<signed long long int>( sZero) == 0LL);
assert(std::saturate_cast<signed long long int>( sBigMax) == LLONG_MAX); // (128-bit) saturated
- { [[maybe_unused]] std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(uBigMax); }
+ std::same_as<signed long long int> decltype(auto) _ = std::saturate_cast<signed long long int>(uBigMax);
assert(std::saturate_cast<signed long long int>( uZero) == 0LL);
assert(std::saturate_cast<signed long long int>( uBigMax) == LLONG_MAX); // (128-bit) saturated
- { [[maybe_unused]] std::same_as<__int128_t> decltype(auto) _ = std::saturate_cast<__int128_t>(SCHAR_MAX); }
+ std::same_as<__int128_t> decltype(auto) _ = std::saturate_cast<__int128_t>(SCHAR_MAX);
assert(std::saturate_cast<__int128_t>(SCHAR_MIN) == static_cast<__int128_t>(SCHAR_MIN));
assert(std::saturate_cast<__int128_t>( O_C) == sZero);
assert(std::saturate_cast<__int128_t>(SCHAR_MAX) == static_cast<__int128_t>(SCHAR_MAX));
- { [[maybe_unused]] std::same_as<__int128_t> decltype(auto) _ = std::saturate_cast<__int128_t>(UCHAR_MAX); }
+ std::same_as<__int128_t> decltype(auto) _ = std::saturate_cast<__int128_t>(UCHAR_MAX);
assert(std::saturate_cast<__int128_t>( O_UC) == sZero);
assert(std::saturate_cast<__int128_t>(UCHAR_MAX) == static_cast<__int128_t>(UCHAR_MAX));
- { [[maybe_unused]] std::same_as<__int128_t> decltype(auto) _ = std::saturate_cast<__int128_t>(sBigMax); }
+ std::same_as<__int128_t> decltype(auto) _ = std::saturate_cast<__int128_t>(sBigMax);
assert(std::saturate_cast<__int128_t>( sBigMin) == sBigMin);
assert(std::saturate_cast<__int128_t>( sZero) == sZero);
assert(std::saturate_cast<__int128_t>( sBigMax) == sBigMax);
- { [[maybe_unused]] std::same_as<__int128_t> decltype(auto) _ = std::saturate_cast<__int128_t>(uBigMax); }
+ std::same_as<__int128_t> decltype(auto) _ = std::saturate_cast<__int128_t>(uBigMax);
assert(std::saturate_cast<__int128_t>( uZero) == sZero);
assert(std::saturate_cast<__int128_t>( uBigMax) == sBigMax); // saturated
#endif
// unsigned char
- { [[maybe_unused]] std::same_as<unsigned char> decltype(auto) _ = std::saturate_cast<unsigned char>(SCHAR_MAX); }
+ std::same_as<unsigned char> decltype(auto) _ = std::saturate_cast<unsigned char>(SCHAR_MAX);
assert(std::saturate_cast<unsigned char>(SCHAR_MIN) == O_UC);
assert(std::saturate_cast<unsigned char>( O_C) == O_UC);
assert(std::saturate_cast<unsigned char>(SCHAR_MAX) == static_cast<unsigned char>(SCHAR_MAX));
- { [[maybe_unused]] std::same_as<unsigned char> decltype(auto) _ = std::saturate_cast<unsigned char>(UCHAR_MAX); }
+ std::same_as<unsigned char> decltype(auto) _ = std::saturate_cast<unsigned char>(UCHAR_MAX);
assert(std::saturate_cast<unsigned char>( O_UC) == O_UC);
assert(std::saturate_cast<unsigned char>(UCHAR_MAX) == UCHAR_MAX);
- { [[maybe_unused]] std::same_as<unsigned char> decltype(auto) _ = std::saturate_cast<unsigned char>(sBigMax); }
+ std::same_as<unsigned char> decltype(auto) _ = std::saturate_cast<unsigned char>(sBigMax);
assert(std::saturate_cast<unsigned char>( sBigMin) == O_UC); // saturated
assert(std::saturate_cast<unsigned char>( sZero) == O_UC);
assert(std::saturate_cast<unsigned char>( sBigMax) == UCHAR_MAX); // saturated
- { [[maybe_unused]] std::same_as<unsigned char> decltype(auto) _ = std::saturate_cast<unsigned char>(uBigMax); }
+ std::same_as<unsigned char> decltype(auto) _ = std::saturate_cast<unsigned char>(uBigMax);
assert(std::saturate_cast<unsigned char>( uZero) == O_UC);
assert(std::saturate_cast<unsigned char>( uBigMax) == UCHAR_MAX); // saturated
// unsigned short
- { [[maybe_unused]] std::same_as<unsigned short int> decltype(auto) _ = std::saturate_cast<unsigned short int>(SCHAR_MAX); }
+ std::same_as<unsigned short int> decltype(auto) _ = std::saturate_cast<unsigned short int>(SCHAR_MAX);
assert(std::saturate_cast<unsigned short int>(SCHAR_MIN) == O_US);
assert(std::saturate_cast<unsigned short int>( O_C) == O_US);
assert(std::saturate_cast<unsigned short int>(SCHAR_MAX) == static_cast<unsigned short int>(SCHAR_MAX));
...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/101826
More information about the libcxx-commits
mailing list