From 1d6168eb4d28f3b1edb57cae7889049a3816f51a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 14 Jan 2026 11:39:14 -0800 Subject: [PATCH 1/2] Remove workarounds for Clang 15 and older. For `__is_scoped_enum`, don't attempt to detect EDG-imitating-Clang, which we historically haven't special-cased or tested. --- stl/inc/type_traits | 3 +-- stl/inc/yvals_core.h | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/stl/inc/type_traits b/stl/inc/type_traits index e4c4d1e392f..fae73ac2bb3 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -346,8 +346,7 @@ _EXPORT_STD template _NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_enum_v = __is_enum(_Ty); #if _HAS_CXX23 -#if defined(__clang__) && !defined(__EDG__) \ - && __clang_major__ >= 16 // TRANSITION, DevCom-10870354 (MSVC, EDG), VSO-2397560 (RWC relying on ancient Clang) +#ifdef __clang__ // TRANSITION, DevCom-10870354 (MSVC, EDG) _EXPORT_STD template _NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_scoped_enum_v = __is_scoped_enum(_Ty); diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index fcb8716af04..7301d3fda1e 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1951,9 +1951,7 @@ _EMIT_STL_ERROR(STL1013, "The STL doesn't support /RTCc because it rejects confo #define _STL_INTERNAL_STATIC_ASSERT(...) #endif // ^^^ !defined(_ENABLE_STL_INTERNAL_CHECK) ^^^ -#if defined(__CUDACC__) || (defined(__clang__) && __clang_major__ < 16) -// TRANSITION, CUDA 12.4 doesn't have downlevel support for static call operators. -// TRANSITION, VSO-2397560, temporary workaround for Real World Code relying on ancient Clang versions. +#ifdef __CUDACC__ // TRANSITION, CUDA 12.4 doesn't have downlevel support for static call operators. #define _STATIC_CALL_OPERATOR #define _CONST_CALL_OPERATOR const #else // ^^^ workaround / no workaround vvv From b73f74d5f07b208b9916fa24a449b674f49e1571 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 14 Jan 2026 12:08:41 -0800 Subject: [PATCH 2/2] Remove workarounds for Clang 18 and older. Fuse away `_USE_BUILTIN_IS_TRIVIALLY_EQUALITY_COMPARABLE`, we don't use escape hatches elsewhere. For `is_layout_compatible`, the condition previously said "if we're not Clang at all (i.e. we're MSVC or EDG-imitating-MSVC), or we're EDG-imitating-Clang, or we're Clang 19+". This is always true now (regardless of the fact that we don't special-case EDG-imitating-Clang). For `is_pointer_interconvertible_base_of`, don't special-case EDG-imitating-Clang when working around LLVM-135273. Again, we don't special-case or test this configuration, and in this case the workaround isn't especially harmful anyways. --- stl/inc/type_traits | 5 +---- stl/inc/xutility | 14 +++----------- stl/inc/yvals.h | 2 -- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/stl/inc/type_traits b/stl/inc/type_traits index fae73ac2bb3..f18d731c04d 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -2013,15 +2013,13 @@ _NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_nothrow_invocable_r_v = #endif // _HAS_CXX17 #if _HAS_CXX20 -#if !defined(__clang__) || defined(__EDG__) \ - || __clang_major__ >= 19 // TRANSITION, VSO-2397560 (RWC relying on ancient Clang) _EXPORT_STD template struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_layout_compatible : bool_constant<__is_layout_compatible(_Ty1, _Ty2)> {}; _EXPORT_STD template _NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_layout_compatible_v = __is_layout_compatible(_Ty1, _Ty2); -#if !defined(__clang__) || defined(__EDG__) // TRANSITION, LLVM-135273 +#ifndef __clang__ // TRANSITION, LLVM-135273 _EXPORT_STD template struct _NO_SPECIALIZATIONS_OF_TYPE_TRAITS is_pointer_interconvertible_base_of : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)> {}; @@ -2038,7 +2036,6 @@ _EXPORT_STD template _NO_SPECIALIZATIONS_OF_TYPE_TRAITS constexpr bool is_pointer_interconvertible_base_of_v = __is_pointer_interconvertible_base_of(remove_cv_t<_Base>, remove_cv_t<_Derived>); #endif // ^^^ workaround ^^^ -#endif // ^^^ no workaround ^^^ #ifndef __clang__ // TRANSITION, LLVM-48860 _EXPORT_STD template diff --git a/stl/inc/xutility b/stl/inc/xutility index 06c1dfa8dcc..da3a93c5214 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -117,14 +117,6 @@ _STL_DISABLE_CLANG_WARNINGS #endif // _USE_STD_VECTOR_FLOATING_ALGORITHMS && !_USE_STD_VECTOR_ALGORITHMS #endif // ^^^ defined(_USE_STD_VECTOR_FLOATING_ALGORITHMS) ^^^ -#ifndef _USE_BUILTIN_IS_TRIVIALLY_EQUALITY_COMPARABLE -#if defined(__clang__) && __clang_major__ >= 19 -#define _USE_BUILTIN_IS_TRIVIALLY_EQUALITY_COMPARABLE 1 -#else // ^^^ defined(__clang__) && __clang_major__ >= 19 / !defined(__clang__) || __clang_major__ < 19 vvv -#define _USE_BUILTIN_IS_TRIVIALLY_EQUALITY_COMPARABLE 0 -#endif // ^^^ !defined(__clang__) || __clang_major__ < 19 ^^^ -#endif // ^^^ !defined(_USE_BUILTIN_IS_TRIVIALLY_EQUALITY_COMPARABLE) ^^^ - extern "C" { // The "noalias" attribute tells the compiler optimizer that pointers going into these hand-vectorized algorithms // won't be stored beyond the lifetime of the function, and that the function will only reference arrays denoted by @@ -5673,14 +5665,14 @@ inline constexpr bool _Can_memcmp_elements = true; template constexpr bool _Can_memcmp_elements<_Ty1*, _Ty2*, false> = _Is_pointer_address_comparable<_Ty1, _Ty2>; -#if _USE_BUILTIN_IS_TRIVIALLY_EQUALITY_COMPARABLE +#ifdef __clang__ template constexpr bool _Is_same_and_builtin_trivially_equality_comparable = is_same_v<_Elem1, _Elem2> && __is_trivially_equality_comparable(_Elem1); -#else // ^^^ _USE_BUILTIN_IS_TRIVIALLY_EQUALITY_COMPARABLE / !_USE_BUILTIN_IS_TRIVIALLY_EQUALITY_COMPARABLE vvv +#else // ^^^ defined(__clang__) / !defined(__clang__) vvv template constexpr bool _Is_same_and_builtin_trivially_equality_comparable = false; -#endif // ^^^ !_USE_BUILTIN_IS_TRIVIALLY_EQUALITY_COMPARABLE ^^^ +#endif // ^^^ !defined(__clang__) ^^^ template constexpr bool _Can_memcmp_elements<_Elem1, _Elem2, false> = diff --git a/stl/inc/yvals.h b/stl/inc/yvals.h index e060f5ae8e6..97361f553af 100644 --- a/stl/inc/yvals.h +++ b/stl/inc/yvals.h @@ -261,8 +261,6 @@ _EMIT_STL_ERROR(STL1008, "_STL_CALL_ABORT_INSTEAD_OF_INVALID_PARAMETER has been #ifndef _MSVC_STL_DOOM_FUNCTION #ifdef _MSVC_STL_USE_ABORT_AS_DOOM_FUNCTION // The user wants to use abort(): #define _MSVC_STL_DOOM_FUNCTION(mesg) _CSTD abort() -#elif defined(__clang__) && __clang_major__ < 19 // TRANSITION, VSO-2397560, Real World Code relying on ancient Clang -#define _MSVC_STL_DOOM_FUNCTION(mesg) __builtin_trap() #elif defined(__clang__) // Use the Clang intrinsic: #define _MSVC_STL_DOOM_FUNCTION(mesg) __builtin_verbose_trap("MSVC STL error", mesg) #elif defined(_M_CEE) // TRANSITION, VSO-2457624 (/clr silent bad codegen for __fastfail); /clr:pure lacks __fastfail