[libcxx-commits] [libcxx] e5d8a15 - [libc++] Backport resolution of LWG2187 to C++11 (#222006)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 9 05:54:20 PDT 2026
Author: A. Jiang
Date: 2026-09-09T20:54:14+08:00
New Revision: e5d8a1573950731a7e8c2163e4b9946d0556768f
URL: https://github.com/llvm/llvm-project/commit/e5d8a1573950731a7e8c2163e4b9946d0556768f
DIFF: https://github.com/llvm/llvm-project/commit/e5d8a1573950731a7e8c2163e4b9946d0556768f.diff
LOG: [libc++] Backport resolution of LWG2187 to C++11 (#222006)
libc++ has LWG2187 implemented in
2d6e2834a8abcce862ef17c44f62e4de41662748 but only since C++14 mode.
Usually, resolution of an LWG issue should be treated as a Defect Report
and applied to old modes. In the case of LWG2187, the resolution should
be applied to C++11.
Added:
Modified:
libcxx/include/__vector/vector_bool.h
libcxx/include/vector
libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/__vector/vector_bool.h b/libcxx/include/__vector/vector_bool.h
index 6269ec287f7f9..12938a90be3aa 100644
--- a/libcxx/include/__vector/vector_bool.h
+++ b/libcxx/include/__vector/vector_bool.h
@@ -322,7 +322,7 @@ class _LIBCPP_WARN_UNUSED vector<bool, _Allocator> {
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(const value_type& __x);
-#if _LIBCPP_STD_VER >= 14
+#ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
# if _LIBCPP_STD_VER >= 17
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference emplace_back(_Args&&... __args)
@@ -349,7 +349,7 @@ class _LIBCPP_WARN_UNUSED vector<bool, _Allocator> {
--__size_;
}
-#if _LIBCPP_STD_VER >= 14
+#ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator emplace(const_iterator __position, _Args&&... __args) {
return insert(__position, value_type(std::forward<_Args>(__args)...));
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 0fb45f67be5f2..a54f21fdc50e6 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -230,12 +230,12 @@ public:
const_reference back() const;
void push_back(const value_type& x);
- template <class... Args> reference emplace_back(Args&&... args); // C++14; reference in C++17
+ template <class... Args> reference emplace_back(Args&&... args); // C++11; returns void/reference until/since C++17
template<container-compatible-range<T> R>
constexpr void append_range(R&& rg); // C++23
void pop_back();
- template <class... Args> iterator emplace(const_iterator position, Args&&... args); // C++14
+ template <class... Args> iterator emplace(const_iterator position, Args&&... args); // C++11
iterator insert(const_iterator position, const value_type& x);
iterator insert(const_iterator position, size_type n, const value_type& x);
template <class InputIterator>
diff --git a/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp
index 810a1968605d8..b2d4fa2215918 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp
@@ -6,7 +6,8 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11
+// REQUIRES: std-at-least-c++11
+
// <vector>
// vector<bool>
diff --git a/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
index 87da6fd9f6019..2d8e72ed54cbe 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
@@ -6,7 +6,8 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11
+// REQUIRES: std-at-least-c++11
+
// <vector>
// vector.bool
More information about the libcxx-commits
mailing list