diff --git a/lldb/source/Utility/Scalar.cpp b/lldb/source/Utility/Scalar.cpp --- a/lldb/source/Utility/Scalar.cpp +++ b/lldb/source/Utility/Scalar.cpp @@ -331,7 +331,7 @@ Scalar &Scalar::operator=(long long v) { m_type = e_slonglong; - m_integer = llvm::APInt(sizeof(long) * 8, v, true); + m_integer = llvm::APInt(sizeof(long long) * 8, v, true); return *this; } diff --git a/lldb/unittests/Utility/ScalarTest.cpp b/lldb/unittests/Utility/ScalarTest.cpp --- a/lldb/unittests/Utility/ScalarTest.cpp +++ b/lldb/unittests/Utility/ScalarTest.cpp @@ -188,6 +188,16 @@ ScalarGetValue(std::numeric_limits::max())); } +TEST(ScalarTest, LongLongAssigmentOperator) { + Scalar ull; + ull = std::numeric_limits::max(); + EXPECT_EQ(std::numeric_limits::max(), ull.ULongLong()); + + Scalar sll; + sll = std::numeric_limits::max(); + EXPECT_EQ(std::numeric_limits::max(), sll.SLongLong()); +} + TEST(ScalarTest, Division) { Scalar lhs(5.0); Scalar rhs(2.0);