diff --git a/lib/checkio.cpp b/lib/checkio.cpp index a76a7c0bf..8a256a59b 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -1374,9 +1374,10 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings, tempToken->str("int"); else if (valuetype->type == ValueType::LONG) tempToken->str("long"); - else if (valuetype->type == ValueType::LONGLONG) + else if (valuetype->type == ValueType::LONGLONG) { tempToken->str("long"); - else if (valuetype->type == ValueType::FLOAT) + tempToken->isLong(true); + } else if (valuetype->type == ValueType::FLOAT) tempToken->str("float"); else if (valuetype->type == ValueType::DOUBLE) tempToken->str("double"); diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 7bc450866..8f019eabb 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -3722,7 +3722,7 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype) else if (type->str() == "int") valuetype->type = ValueType::Type::INT; else if (type->str() == "long") - valuetype->type = ValueType::Type::LONG; + valuetype->type = type->isLong() ? ValueType::Type::LONGLONG : ValueType::Type::LONG; else if (type->str() == "float") valuetype->type = ValueType::Type::FLOAT; else if (type->str() == "double") diff --git a/test/testio.cpp b/test/testio.cpp index 1d6e013dd..27fe24027 100644 --- a/test/testio.cpp +++ b/test/testio.cpp @@ -3730,6 +3730,12 @@ private: " printf(\"%c\", \"hello\"[0]);\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + check("void test() {\n" + " printf(\"%lld\", (long long)1);\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } }; diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 6ff2b1b44..3a2edf7cb 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -2980,6 +2980,9 @@ private: // cast.. ASSERT_EQUALS("char", typeOf("a = (char)32;", "(")); + ASSERT_EQUALS("long", typeOf("a = (long)32;", "(")); + ASSERT_EQUALS("long", typeOf("a = (long int)32;", "(")); + ASSERT_EQUALS("long long", typeOf("a = (long long)32;", "(")); } };