Skip to content

Commit 81d43eb

Browse files
committed
Explicitly initialize __bit_per_word to avoid gdb.error
1 parent 233eeb3 commit 81d43eb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libcxx/include/bitset

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ protected:
473473
typedef __bitset __self;
474474
typedef __storage_type* __storage_pointer;
475475
typedef const __storage_type* __const_storage_pointer;
476-
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
476+
static const unsigned __bits_per_word;
477477

478478
friend class __bit_reference<__bitset>;
479479
friend class __bit_const_reference<__bitset>;
@@ -519,16 +519,16 @@ protected:
519519
_LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT;
520520
};
521521

522+
template <size_t _Size>
523+
const unsigned __bitset<1, _Size>::__bits_per_word =
524+
static_cast<unsigned>(sizeof(typename __bitset<1, _Size>::__storage_type) * CHAR_BIT);
525+
522526
template <size_t _Size>
523527
inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset() _NOEXCEPT : __first_(0) {}
524528

525529
template <size_t _Size>
526530
inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
527-
: __first_(static_cast<__storage_type>(__v)) {
528-
// Force __bits_per_word to be instantiated to avoid "gdb.error: There is no member or method named
529-
// __bits_per_word"
530-
(void)__bits_per_word;
531-
}
531+
: __first_(static_cast<__storage_type>(__v)) {}
532532

533533
template <size_t _Size>
534534
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void

0 commit comments

Comments
 (0)