diff --git a/src/common/any.cpp b/src/common/any.cpp index f47792366c..54640f8521 100644 --- a/src/common/any.cpp +++ b/src/common/any.cpp @@ -165,7 +165,7 @@ bool wxConvertAnyToVariant(const wxAny& any, wxVariant* variant) if ( ll > wxINT32_MAX || ll < wxINT32_MIN ) *variant = wxLongLong(ll); else - *variant = (long) wxLongLong(ll).GetLo(); + *variant = static_cast(ll); } else { diff --git a/tests/any/anytest.cpp b/tests/any/anytest.cpp index 08546a2949..b5375a1fb7 100644 --- a/tests/any/anytest.cpp +++ b/tests/any/anytest.cpp @@ -617,6 +617,12 @@ void wxAnyTestCase::wxVariantConversions() CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetType() == "ulonglong"); CPPUNIT_ASSERT(variant.GetULongLong() == wxULongLong(wxULL(123456))); + + any = (wxLongLong_t)-1; + res = any.GetAs(&variant); + CPPUNIT_ASSERT(res); + CPPUNIT_ASSERT(variant.GetType() == "long"); + CPPUNIT_ASSERT(variant.GetLong() == -1); #endif // Cannot test equality for the rest, just test that they convert