[libcxx-commits] [PATCH] D132061: [libc++] static_assert preconditions in vector

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 2 18:14:11 PDT 2022


EricWF added a comment.

This change doesn't improve conformance, right? It just attempts to make the diagnostics nicer in a handful of cases where the error occurs in the immediate function call to the allocator?



================
Comment at: libcxx/include/__memory/allocator_traits.h:402
 struct __is_cpp17_copy_insertable
-    : integral_constant<bool,
-        is_copy_constructible<typename _Alloc::value_type>::value &&
-        __is_cpp17_move_insertable<_Alloc>::value
-    >
-{ };
+    : _And<__is_cpp17_move_insertable<_Alloc>,
+           __is_cpp17_emplace_constructible<_Alloc, typename allocator_traits<_Alloc>::value_type&>,
----------------
Is `_And` still lazy? If so, do we really need the additional instantiations


================
Comment at: libcxx/include/__memory/allocator_traits.h:374
+template <class _Alloc, class... _Args>
+decltype(allocator_traits<_Alloc>::construct(std::declval<_Alloc&>(),
+                                             std::declval<typename allocator_traits<_Alloc>::value_type*>(),
----------------
Can't a user provided overload of `operator,` sneak in here?


================
Comment at: libcxx/test/libcxx/containers/sequences/vector/preconditions.verify.cpp:58
+  // expected-error@* {{failed due to requirement}}
+  v6.resize(1, NotCopyInsertable(1)); // expected-node {{from here}}
+}
----------------
expected-note


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132061/new/

https://reviews.llvm.org/D132061



More information about the libcxx-commits mailing list