#8509 Uniform initialization ignored for iterator

This commit is contained in:
amai2012 2018-04-26 08:57:25 +02:00
parent d8634ca2a9
commit 55983e2a0b
2 changed files with 9 additions and 1 deletions

View File

@ -138,7 +138,7 @@ void CheckStl::iterators()
continue;
// the validIterator flag says if the iterator has a valid value or not
bool validIterator = Token::Match(var->nameToken()->next(), "[(=:]");
bool validIterator = Token::Match(var->nameToken()->next(), "[(=:{]");
const Scope* invalidationScope = nullptr;
// The container this iterator can be used with

View File

@ -555,6 +555,14 @@ private:
" }\n"
"}");
ASSERT_EQUALS("", errout.str());
// #8509 Uniform initialization ignored for iterator
check("void f() {\n"
" std::vector<int> ints;\n"
" std::vector<int>::const_iterator iter {ints.cbegin()};\n"
" std::cout << (*iter) << std::endl;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void dereference_break() { // #3644