https://gcc.gnu.org/g:1c719fd95799ad3599c46e504e5c2cc07a930e2f

commit r16-8463-g1c719fd95799ad3599c46e504e5c2cc07a930e2f
Author: Matthias Kretz <[email protected]>
Date:   Wed Apr 1 11:46:08 2026 +0200

    libstdc++: Guard use of float16_t and bfloat16_t [PR124722]
    
    The rest of this test is still relevant, thus only the (b)float16_t
    tests are made optional rather than skipping the whole test via
    dg-effective-target.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/124722
            * testsuite/std/simd/traits_impl.cc: Add __STDCPP_FLOAT16_T__
            and __STDCPP_BFLOAT16_T__ guards.
    
    Signed-off-by: Matthias Kretz <[email protected]>

Diff:
---
 libstdc++-v3/testsuite/std/simd/traits_impl.cc | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/std/simd/traits_impl.cc 
b/libstdc++-v3/testsuite/std/simd/traits_impl.cc
index a264bd5f1400..06bf6d5be256 100644
--- a/libstdc++-v3/testsuite/std/simd/traits_impl.cc
+++ b/libstdc++-v3/testsuite/std/simd/traits_impl.cc
@@ -9,7 +9,9 @@
 
 namespace simd = std::simd;
 
+#ifdef __STDCPP_FLOAT16_T__
 using std::float16_t;
+#endif
 using std::float32_t;
 using std::float64_t;
 
@@ -17,7 +19,11 @@ using namespace std::simd;
 
 void test()
 {
-  template for (auto t : {float(), double(), float16_t(), float32_t(), 
float64_t()})
+  template for (auto t : {float(), double(),
+#ifdef __STDCPP_FLOAT16_T__
+                         float16_t(),
+#endif
+                         float32_t(), float64_t()})
     {
       using T = decltype(t);
       static_assert(__vectorizable<T>);
@@ -25,7 +31,9 @@ void test()
 
   static_assert(!__vectorizable<const float>);
   static_assert(!__vectorizable<float&>);
+#ifdef __STDCPP_BFLOAT16_T__
   static_assert(!__vectorizable<std::bfloat16_t>);
+#endif
 
   template for (constexpr int N : {1, 2, 4, 8})
     {
@@ -82,8 +90,10 @@ void test()
   static_assert( __value_preserving_convertible_to<float, double>);
   static_assert(!__value_preserving_convertible_to<double, float>);
 
+#ifdef __STDCPP_FLOAT16_T__
   static_assert(__explicitly_convertible_to<float, float16_t>);
   static_assert(__explicitly_convertible_to<long, float16_t>);
+#endif
 
   static_assert(__constexpr_wrapper_like<std::constant_wrapper<2>>);
   static_assert(__constexpr_wrapper_like<std::integral_constant<int, 1>>);
@@ -95,7 +105,9 @@ void test()
   static_assert(!__broadcast_constructible<const int, float>);
 
   static_assert(__broadcast_constructible<decltype(std::cw<2>), float>);
+#ifdef __STDCPP_FLOAT16_T__
   static_assert(__broadcast_constructible<decltype(std::cw<0.f>), 
std::float16_t>);
+#endif
 
 
   static_assert(__higher_rank_than<long, int>);
@@ -112,7 +124,9 @@ void test()
   static_assert(__higher_rank_than<unsigned long, int>);
   static_assert(__higher_rank_than<unsigned long long, long>);
 
+#ifdef __STDCPP_FLOAT16_T__
   static_assert(__higher_rank_than<float, float16_t>);
+#endif
   static_assert(__higher_rank_than<float32_t, float>);
   static_assert(__higher_rank_than<double, float32_t>);
   static_assert(__higher_rank_than<double, float>);

Reply via email to