diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 5aaf2722898..b0010471316 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -738,6 +738,8 @@ std::vector getParentValueTypes(const Token* tok, const Settings& set continue; nameTok = var->nameToken(); result.push_back(*var->valueType()); + if (var->isArray()) + result.back().pointer += var->dimensions().size(); } if (result.size() == 1 && nameTok && parent) { *parent = nameTok; diff --git a/test/testother.cpp b/test/testother.cpp index 57d73c4df2b..f43cd28a6a8 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -12404,6 +12404,13 @@ class TestOther : public TestFixture { " if (!ptr || !ptr()) {}\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + check("void g(bool b[2]);\n" // #12822 + "void f() {\n" + " bool b[2] = {};\n" + " g(b);\n" + "}"); + ASSERT_EQUALS("", errout_str()); } void iterateByValue() {