From b9644e7f6c30188923ce1d55b03de12709d447f8 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:14:41 +0100 Subject: [PATCH] Add test for #9960 (#7266) --- test/testsymboldatabase.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index b934d2c7306..e0553ba5b37 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -5675,6 +5675,21 @@ class TestSymbolDatabase : public TestFixture { ASSERT_EQUALS(3, db->scopeList.size()); ASSERT_EQUALS(Scope::ScopeType::eFor, db->scopeList.back().type); ASSERT_EQUALS(1, db->scopeList.back().varlist.size()); + ASSERT_EQUALS("i", db->scopeList.back().varlist.back().name()); + } + { + GET_SYMBOL_DB_DBG("void bar(int) {}\n" // #9960 + "void foo() {\n" + " std::vector a(10);\n" + " for (int i = 0; i < 10; i++)\n" + " bar(*a[4]);\n" + "}\n"); + ASSERT(db != nullptr); + ASSERT_EQUALS("", errout_str()); + ASSERT_EQUALS(4, db->scopeList.size()); + ASSERT_EQUALS(Scope::ScopeType::eFor, db->scopeList.back().type); + ASSERT_EQUALS(1, db->scopeList.back().varlist.size()); + ASSERT_EQUALS("i", db->scopeList.back().varlist.back().name()); } }