Fix PR#35438 - bitset constructor does not zero unused bits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319074 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/bitset b/include/bitset
index 583122f..e26e674 100644
--- a/include/bitset
+++ b/include/bitset
@@ -503,7 +503,10 @@
inline
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
- : __first_(static_cast<__storage_type>(__v))
+ : __first_(
+ _Size == __bits_per_word ? static_cast<__storage_type>(__v)
+ : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1)
+ )
{
}