diff --git a/libc/src/__support/CPP/cstddef.h b/libc/src/__support/CPP/cstddef.h index 1da51fd253fb5..111265d38cde7 100644 --- a/libc/src/__support/CPP/cstddef.h +++ b/libc/src/__support/CPP/cstddef.h @@ -16,6 +16,10 @@ namespace LIBC_NAMESPACE::cpp { enum class byte : unsigned char {}; +// When built with clang, this will use the definition from the clang header +// __stddef_max_align_t.h +using ::max_align_t LIBC_USING_IF_EXISTS; + template LIBC_INLINE constexpr enable_if_t, byte> operator>>(byte b, IntegerType shift) noexcept { diff --git a/libc/src/__support/macros/attributes.h b/libc/src/__support/macros/attributes.h index 8637e165fe3bc..40b67281767f8 100644 --- a/libc/src/__support/macros/attributes.h +++ b/libc/src/__support/macros/attributes.h @@ -30,4 +30,10 @@ #define LIBC_THREAD_LOCAL thread_local #endif +#if __has_attribute(__using_if_exists__) +#define LIBC_USING_IF_EXISTS __attribute__((__using_if_exists__)) +#else +#define LIBC_USING_IF_EXISTS +#endif + #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_ATTRIBUTES_H