[libcxx-commits] [libcxx] [libc++] std::byteswap support for _BitInt(N) (PR #196512)
Xavier Roche via libcxx-commits
libcxx-commits at lists.llvm.org
Sun May 10 07:54:34 PDT 2026
================
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// __builtin_bswapg was added in Clang 22. std::byteswap for _BitInt(N)
+// defers to that builtin, so the rejection diagnostic for non-multiple-
+// of-16-bit widths only fires on Clang 22+. Skip on Clang 21.
+// UNSUPPORTED: clang-21
+
+// <bit>
+
+// std::byteswap rejects _BitInt(N) where the bit width is not a multiple
+// of 16. The diagnostic comes from Clang's __builtin_bswapg sema check.
+
----------------
xroche wrote:
Done; the requires clause to the function template now also excludes types __builtin_bswapg can't handle
https://github.com/llvm/llvm-project/pull/196512
More information about the libcxx-commits
mailing list