[libcxx-commits] [libcxx] 93df7b9 - [libc++][ABI Break] Make is_error_condition_enum_v and is_error_code_enum_v bool, not size_t
Joe Loser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Oct 28 12:40:02 PDT 2021
Author: Joe Loser
Date: 2021-10-28T15:38:17-04:00
New Revision: 93df7b9f75af6b4282565e6e98bb306590375820
URL: https://github.com/llvm/llvm-project/commit/93df7b9f75af6b4282565e6e98bb306590375820
DIFF: https://github.com/llvm/llvm-project/commit/93df7b9f75af6b4282565e6e98bb306590375820.diff
LOG: [libc++][ABI Break] Make is_error_condition_enum_v and is_error_code_enum_v bool, not size_t
`is_error_condition_enum_v` and `is_error_code_enum_v` are currently of
type `size_t`, but the standard mandates they are of type `bool`.
This is an ABI break technically since the size of these variable
templates has changed. Document it as such in the release notes.
Fixes https://bugs.llvm.org/show_bug.cgi?id=50755
Reviewed By: ldionne, Quuxplusone, #libc, var-const
Differential Revision: https://reviews.llvm.org/D112553
Added:
Modified:
libcxx/docs/ReleaseNotes.rst
libcxx/include/system_error
libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index 7ad192361b09..d2713a9bfe4b 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -78,6 +78,12 @@ API Changes
exceeds the maximum supported size, as required by the C++ standard.
Previously the type ``std::length_error`` was used.
+ABI Changes
+-----------
+
+- The C++17 variable templates ``is_error_code_enum_v`` and
+ ``is_error_condition_enum_v`` are now of type ``bool`` instead of ``size_t``.
+
Build System Changes
--------------------
diff --git a/libcxx/include/system_error b/libcxx/include/system_error
index db87c98ec877..fcb9079bdf6e 100644
--- a/libcxx/include/system_error
+++ b/libcxx/include/system_error
@@ -46,10 +46,10 @@ template <class T> struct is_error_condition_enum
: public false_type {};
template <class _Tp>
-inline constexpr size_t is_error_condition_enum_v = is_error_condition_enum<_Tp>::value; // C++17
+inline constexpr bool is_error_condition_enum_v = is_error_condition_enum<_Tp>::value; // C++17
template <class _Tp>
-inline constexpr size_t is_error_code_enum_v = is_error_code_enum<_Tp>::value; // C++17
+inline constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value; // C++17
class error_code
{
@@ -165,7 +165,7 @@ struct _LIBCPP_TEMPLATE_VIS is_error_code_enum
#if _LIBCPP_STD_VER > 14
template <class _Tp>
-inline constexpr size_t is_error_code_enum_v = is_error_code_enum<_Tp>::value;
+inline constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value;
#endif
// is_error_condition_enum
@@ -176,7 +176,7 @@ struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum
#if _LIBCPP_STD_VER > 14
template <class _Tp>
-inline constexpr size_t is_error_condition_enum_v = is_error_condition_enum<_Tp>::value;
+inline constexpr bool is_error_condition_enum_v = is_error_condition_enum<_Tp>::value;
#endif
template <>
diff --git a/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp b/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
index 2a44b5ee352d..80735ba377f4 100644
--- a/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
@@ -23,6 +23,7 @@ test()
static_assert((std::is_error_code_enum<T>::value == Expected), "");
#if TEST_STD_VER > 14
static_assert((std::is_error_code_enum_v<T> == Expected), "");
+ ASSERT_SAME_TYPE(decltype(std::is_error_code_enum_v<T>), const bool);
#endif
}
diff --git a/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp b/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
index 46178e6dbe48..2f766e6f6291 100644
--- a/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
@@ -23,6 +23,7 @@ test()
static_assert((std::is_error_condition_enum<T>::value == Expected), "");
#if TEST_STD_VER > 14
static_assert((std::is_error_condition_enum_v<T> == Expected), "");
+ ASSERT_SAME_TYPE(decltype(std::is_error_condition_enum_v<T>), const bool);
#endif
}
More information about the libcxx-commits
mailing list