Do not suggest pass by reference for std::initializer_list
This commit is contained in:
parent
722fac391d
commit
3022d74801
|
@ -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.
|
||||
|
|
|
@ -1386,6 +1386,9 @@ private:
|
|||
check("void f(const std::streamoff pos) {}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(std::initializer_list<int> 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());
|
||||
|
|
Loading…
Reference in New Issue