diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index f96bf2a63c8..4fcf273b4d3 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1361,7 +1361,8 @@ void CheckClass::checkMemset() if (numIndirToVariableType == 1) type = var->typeScope(); - if (!type && !var->isPointer() && mSettings->library.detectContainerOrIterator(var->typeStartToken())) { + if (!type && !var->isPointer() && !Token::simpleMatch(var->typeStartToken(), "std :: array") && + mSettings->library.detectContainerOrIterator(var->typeStartToken())) { memsetError(tok, tok->str(), var->getTypeName(), {}, /*isContainer*/ true); } } diff --git a/test/testclass.cpp b/test/testclass.cpp index 0f857e2ac64..c5ff896d364 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -3145,6 +3145,12 @@ class TestClass : public TestFixture { " f
(Dst, Src, 2);\n"
"}\n", s);
ASSERT_EQUALS("", errout.str());
+
+ checkNoMemset("void f() {\n"
+ " std::array