From f77d9db8522a0ccd615dd8128d340ce849d69676 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 26 Aug 2021 19:37:29 +0200 Subject: [PATCH] Add test case for #10383 (#3421) --- test/teststl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/teststl.cpp b/test/teststl.cpp index ffbc530b0..52e9d2113 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -589,6 +589,18 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + checkNormal("bool g();\n" + "void f(int x) {\n" + " std::vector 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 &v) {\n" " if(v.size() >=1 && v[0] == 4 && v[1] == 2){}\n" "}\n");