[all-commits] [llvm/llvm-project] 5805e4: [ADT] Use static_assert in PackedVector (#164142)

Kazu Hirata via All-commits all-commits at lists.llvm.org
Sun Oct 19 08:34:13 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5805e4d1a05e5faf805bb28b5ba5604d58834e45
      https://github.com/llvm/llvm-project/commit/5805e4d1a05e5faf805bb28b5ba5604d58834e45
  Author: Kazu Hirata <kazu at google.com>
  Date:   2025-10-19 (Sun, 19 Oct 2025)

  Changed paths:
    M llvm/include/llvm/ADT/PackedVector.h

  Log Message:
  -----------
  [ADT] Use static_assert in PackedVector (#164142)

This patch replaces an intentionally undefined template
specialization:

  template <typename T> class PackedVector<T, 0>;

with:

  static_assert(BitNum > 0, "BitNum must be > 0");

This way, the compiler diagnostic on a use of PackedVector<T, 0>
improves from:

  error: implicit instantiation of undefined template
  'llvm::PackedVector<unsigned int, 0>'

to:

  error: static assertion failed due to requirement '0U > 0': BitNum
  must be > 0



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