[clang] [Clang] Implement P2843R3 - Preprocessing is never undefined (PR #192073)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 21 06:47:17 PDT 2026


AaronBallman wrote:

> > Hi, I think we're seeing this fail in our CI when building libcxx with clang-cl against the windows SDK. We see this in our windows, linux and mac builders across both x86_64 and Aarch64. We've been using this version of the SDK for quite a while, and AFAIK it's still widely used and supported. Would you mind taking a look? Maybe there's some missing compatibility checks clang is missing to use the new behavior?
> 
> Hmm, seems there has an UB in WinBase.h. Since C++26 P2843R3, `#define MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS (_WIN32_WINNT >= 0x0502 || !defined(_WINBASE_))` should be ill-formed.
> 
> @AaronBallman @cor3ntin Should we block this feature?

At a minimum, I think it's worth providing this as feedback to WG21. But yeah, because this is in a system header, we should ensure this behaves the same as it would with MSVC, particularly in `-fms-extensions` mode (presuming MSVC defines this behavior as well).

We could make this a warning which defaults to an error, and downgrade to just vanilla warning if in the system header, too because that construct looks like it would come up in reasonable code.

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


More information about the cfe-commits mailing list