Debian Codegraph @

gcc/testsuite/g++.dg/DRs/dr2836.C

raw
1 // DR 2836 - Conversion rank of long double and extended floating-point types
2 // { dg-do compile { target c++23 } }
3 // { dg-additional-options "-mlong-double-64" { target powerpc*-*-* s390*-*-* } }
4
5 #include <stdfloat>
6
7 #if defined (__STDCPP_FLOAT64_T__) \
8 && __LDBL_MAX_EXP__ == __FLT64_MAX_EXP__ \
9 && __LDBL_MANT_DIG__ == __FLT64_MANT_DIG__ \
10 && __DBL_MAX_EXP__ == __FLT64_MAX_EXP__ \
11 && __DBL_MANT_DIG__ == __FLT64_MANT_DIG__
12 auto
13 foo (long double x, std::float64_t y)
14 {
15 return x + y;
16 }
17
18 template<typename T, T v> struct integral_constant {
19 static constexpr T value = v;
20 };
21 typedef integral_constant<bool, false> false_type;
22 typedef integral_constant<bool, true> true_type;
23 template<class T, class U>
24 struct is_same : false_type {};
25 template <class T>
26 struct is_same<T, T> : true_type {};
27
28 static_assert (is_same <decltype (foo (1.0L, 1.0F64)), long double>::value);
29
30 #endif