[PATCH] D54966: Implement P1007R3 `std::assume_aligned`

Marshall Clow via Phabricator reviews at reviews.llvm.org
Wed Nov 28 07:10:21 PST 2018


mclow.lists marked 4 inline comments as done.
mclow.lists added a comment.

Chandler has said to me (via IRC) that when called at constexpr time, this should just be a `return __p`. I'll add that after we have `std:: is_constant_evaluated`



================
Comment at: include/memory:5590
+template<size_t _Sz, class _Tp>
+_LIBCPP_NODISCARD_ATTRIBUTE 
+constexpr _Tp* assume_aligned(_Tp * __p) noexcept
----------------
ldionne wrote:
> `_LIBCPP_INLINE_VISIBILITY`?
Right.



================
Comment at: test/std/utilities/memory/ptr.align/assume_aligned.pass.cpp:28
+{
+	ASSERT_SAME_TYPE(T*, decltype(std::assume_aligned<1, T>(p)));
+	assert((p == std::assume_aligned<1>(p)));
----------------
ldionne wrote:
> mclow.lists wrote:
> > Needs a `LIBCPP_ASSERT_NOEXCEPT(std::assume_aligned<1, T>(p))`
> This check needs to go into `test/libcxx/<...>`.
I don't think we need an entire test just for one line.
We have that macro specifically for libc++-specific assertions.



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

https://reviews.llvm.org/D54966





More information about the libcxx-commits mailing list