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

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 8 04:05:22 PDT 2026


================
@@ -22,6 +22,8 @@ _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, "_Alignment should be a power of two.");
----------------
philnik777 wrote:

```suggestion
  static_assert(_Alignment != 0 && (_Alignment & (_Alignment - 1)) == 0, "alignment must be a power of two.");
```
I don't think it makes a ton of sense to use reserved names here. "alignment" should be clear enough.

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


More information about the libcxx-commits mailing list