Add test case for #10383 (#3421)

This commit is contained in:
chrchr-github 2021-08-26 19:37:29 +02:00 committed by GitHub
parent b2852de456
commit f77d9db852
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -589,6 +589,18 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
checkNormal("bool g();\n"
"void f(int x) {\n"
" std::vector<int> v;\n"
" if (g())\n"
" v.emplace_back(x);\n"
" const int n = v.size();\n"
" h(n);\n"
" for (int i = 0; i < n; ++i)\n"
" h(v[i]);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
checkNormal("void foo(const std::vector<int> &v) {\n"
" if(v.size() >=1 && v[0] == 4 && v[1] == 2){}\n"
"}\n");