Skip to content

Commit 52da2db

Browse files
authored
[libc][complex] check that cfloat128 is not defined as _Complex long double (#119324)
Fix buildbot errors in #118671
1 parent 4fb1cda commit 52da2db

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

libc/include/llvm-libc-types/cfloat128.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ typedef _Complex _Float128 cfloat128;
3535
typedef _Complex __float128 cfloat128;
3636
#elif (LDBL_MANT_DIG == 113)
3737
#define LIBC_TYPES_HAS_CFLOAT128
38+
#define LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE
3839
typedef _Complex long double cfloat128;
3940
#endif
4041

libc/src/__support/complex_type.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ template <> struct make_complex<float16> {
3737
};
3838
#endif
3939
#if defined(LIBC_TYPES_HAS_CFLOAT128)
40+
#if !(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
4041
template <> struct make_complex<float128> {
4142
using type = cfloat128;
4243
};
4344
#endif
45+
#endif
4446

4547
template <typename T> using make_complex_t = typename make_complex<T>::type;
4648

@@ -62,10 +64,12 @@ template <> struct make_real<cfloat16> {
6264
};
6365
#endif
6466
#if defined(LIBC_TYPES_HAS_CFLOAT128)
67+
#if !(LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE)
6568
template <> struct make_real<cfloat128> {
6669
using type = float128;
6770
};
6871
#endif
72+
#endif
6973

7074
template <typename T> using make_real_t = typename make_real<T>::type;
7175

0 commit comments

Comments
 (0)