[libc-commits] [libc] [libc] Implement `CMPLX` for clang < 12 (PR #157096)

via libc-commits libc-commits at lists.llvm.org
Fri Sep 5 06:01:28 PDT 2025


================
@@ -22,21 +22,26 @@
 
 // TODO: Add imaginary macros once GCC or Clang support _Imaginary builtin-type.
 
-#define CMPLX(x, y) __builtin_complex((double)(x), (double)(y))
-#define CMPLXF(x, y) __builtin_complex((float)(x), (float)(y))
-#define CMPLXL(x, y) __builtin_complex((long double)(x), (long double)(y))
+#if !defined(__clang__) || (__clang_major__ >= 12)
----------------
lntue wrote:

what about `#if __has_builtin(__builtin_complex)` instead?

https://github.com/llvm/llvm-project/pull/157096


More information about the libc-commits mailing list