[libcxx-commits] [libcxx] 3748162 - Revert "[libc++] Use _If for conditional_t (#96193)"
Benjamin Kramer via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 27 00:27:26 PDT 2024
Author: Benjamin Kramer
Date: 2024-06-27T09:19:13+02:00
New Revision: 37481628ba4c069c2ddc471b2e2036f883405938
URL: https://github.com/llvm/llvm-project/commit/37481628ba4c069c2ddc471b2e2036f883405938
DIFF: https://github.com/llvm/llvm-project/commit/37481628ba4c069c2ddc471b2e2036f883405938.diff
LOG: Revert "[libc++] Use _If for conditional_t (#96193)"
This reverts commit 2274c66e6faaaf29ad693b1ae3e5a7b0228a1950. It makes
libc++ non-conforming, see discussion on the PR.
Added:
Modified:
libcxx/include/__type_traits/conditional.h
Removed:
################################################################################
diff --git a/libcxx/include/__type_traits/conditional.h b/libcxx/include/__type_traits/conditional.h
index 7d5849ee824e3..5b5445a837427 100644
--- a/libcxx/include/__type_traits/conditional.h
+++ b/libcxx/include/__type_traits/conditional.h
@@ -44,14 +44,15 @@ struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {
using type _LIBCPP_NODEBUG = _Then;
};
-template <bool _Bp, class _IfRes, class _ElseRes>
-using __conditional_t _LIBCPP_NODEBUG = _If<_Bp, _IfRes, _ElseRes>;
-
#if _LIBCPP_STD_VER >= 14
template <bool _Bp, class _IfRes, class _ElseRes>
-using conditional_t _LIBCPP_NODEBUG = __conditional_t<_Bp, _IfRes, _ElseRes>;
+using conditional_t _LIBCPP_NODEBUG = typename conditional<_Bp, _IfRes, _ElseRes>::type;
#endif
+// Helper so we can use "conditional_t" in all language versions.
+template <bool _Bp, class _If, class _Then>
+using __conditional_t _LIBCPP_NODEBUG = typename conditional<_Bp, _If, _Then>::type;
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___TYPE_TRAITS_CONDITIONAL_H
More information about the libcxx-commits
mailing list