diff --git a/lib/checkother.cpp b/lib/checkother.cpp index ed332119c..3c06188f3 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1455,7 +1455,7 @@ void CheckOther::checkPassByReference() const Token* const tok = var->typeStartToken(); if (var->isStlStringType()) { ; - } else if (var->isStlType() && Token::Match(tok, "std :: %type% <") && !Token::simpleMatch(tok->linkAt(3), "> ::")) { + } else if (var->isStlType() && Token::Match(tok, "std :: %type% <") && !Token::simpleMatch(tok->linkAt(3), "> ::") && tok->strAt(2) != "initializer_list") { ; } else if (var->type() && !var->type()->isEnumType()) { // Check if type is a struct or class. // Ensure that it is a large object. diff --git a/test/testother.cpp b/test/testother.cpp index f70097951..9dbe1016f 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1386,6 +1386,9 @@ private: check("void f(const std::streamoff pos) {}"); ASSERT_EQUALS("", errout.str()); + check("void f(std::initializer_list i) {}"); + ASSERT_EQUALS("", errout.str()); + // #5824 check("void log(const std::string& file, int line, const std::string& function, const std::string str, ...) {}"); ASSERT_EQUALS("", errout.str());