[libcxx-commits] [libcxx] [libc++] Implement LWG4290: Missing Mandates clauses on is_sufficiently_aligned (PR #229765)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 8 01:58:34 PDT 2026


================
@@ -22,6 +22,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <size_t _Alignment, class _Tp>
 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __is_sufficiently_aligned(_Tp* __ptr) {
+  static_assert(_Alignment != 0 && (_Alignment & (_Alignment - 1)) == 0,
+                "std::is_sufficiently_aligned<Alignment>(p) requires Alignment to be a power of two");
----------------
KaroliShp wrote:

Thanks, that makes sense, I shortened the message to "_Alignment should be a power of two."

https://github.com/llvm/llvm-project/pull/229765


More information about the libcxx-commits mailing list