[all-commits] [llvm/llvm-project] 660771: Reapply "[ADT] Bitset: add shift operators, word a...

Jiachen Yuan via All-commits all-commits at lists.llvm.org
Fri Jun 12 11:11:08 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 660771d4359b14fe56a5eef19c33f93475aee39e
      https://github.com/llvm/llvm-project/commit/660771d4359b14fe56a5eef19c33f93475aee39e
  Author: Jiachen Yuan <jiacheny at nvidia.com>
  Date:   2026-06-12 (Fri, 12 Jun 2026)

  Changed paths:
    M llvm/include/llvm/ADT/Bitset.h
    M llvm/unittests/ADT/BitsetTest.cpp

  Log Message:
  -----------
  Reapply "[ADT] Bitset: add shift operators, word accessors, and etc" (#195874)

Reapplies #193400, which was reverted in #195848 because it broke
buildbots with:

```
Bitset.h:271: error: static assertion failed: Unsupported word size
```

Root cause: a `static_assert(BitwordBits == 32, ...)` inside the
discarded `else` branch of `if constexpr (BitwordBits == 64)` in
`getWord64()`. The assert's condition is non-template-dependent
(`BitwordBits` derives from `sizeof(uintptr_t)`, not from `NumBits`), so
it is checked even though the branch is discarded, and fires on 64-bit
hosts. Related:
https://stackoverflow.com/questions/38304847/how-does-a-failed-static-assert-work-in-an-if-constexpr-false-block

Fix: drop the redundant inner `static_assert`. The class-level
`static_assert(BitwordBits == 64 || BitwordBits == 32, ...)` already
enforces the same invariant.

No functional change beyond the original PR.

---------

Co-authored-by: Rahul Joshi <rjoshi at nvidia.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list