From 4483c3e8201e81332a452b494eb978f7bbc5e4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 23 Oct 2014 06:52:19 +0200 Subject: [PATCH] Fixed #6234 (FP : shift by too many bits is undefined on a QT container) --- lib/checktype.cpp | 2 +- test/testtype.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/checktype.cpp b/lib/checktype.cpp index 2faa922e5..6bf864ec1 100644 --- a/lib/checktype.cpp +++ b/lib/checktype.cpp @@ -124,7 +124,7 @@ void CheckType::checkTooBigBitwiseShift() lhsbits = _settings->sizeof_int * 8; break; } - if (type == var->typeEndToken()) + if (type == var->typeEndToken() || type->str() == "<") break; } if (lhsbits == 0) diff --git a/test/testtype.cpp b/test/testtype.cpp index b36b780b3..78c2ead0a 100644 --- a/test/testtype.cpp +++ b/test/testtype.cpp @@ -79,6 +79,12 @@ private: " return (long long)x << 40;\n" "}",&settings); ASSERT_EQUALS("", errout.str()); + + check("void foo() {\n" + " QList someList;\n" + " someList << 300;\n" + "}", &settings); + ASSERT_EQUALS("", errout.str()); } void checkIntegerOverflow() {