Fixed #5042 (false positive: Redundant code (set filled in initialization list))
This commit is contained in:
parent
53adafb1f2
commit
6830d5f7a4
|
@ -2078,6 +2078,10 @@ void CheckOther::checkIncompleteStatement()
|
|||
else if (Token::Match(tok,"> %var% {") || Token::Match(tok, "[;{}] return {"))
|
||||
tok = tok->linkAt(2);
|
||||
|
||||
// C++11 initialize set in initalizer list : [,:] std::set<int>{1} [{,]
|
||||
else if (Token::Match(tok,"> {") && tok->link())
|
||||
tok = tok->next()->link();
|
||||
|
||||
else if (Token::Match(tok, "[;{}] %str%") || Token::Match(tok, "[;{}] %num%")) {
|
||||
// No warning if numeric constant is followed by a "." or ","
|
||||
if (Token::Match(tok->next(), "%num% [,.]"))
|
||||
|
|
|
@ -181,6 +181,10 @@ private:
|
|||
check("A::A() : abc{0} {}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #5042 - C++11 initializer list
|
||||
check("A::A() : abc::def<int>{0} {}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #4503 - vector init
|
||||
check("void f() { vector<int> v{1}; }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
|
Loading…
Reference in New Issue