diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 5fc6d7b9b..e264cbf82 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1361,6 +1361,8 @@ void CheckOther::checkConstVariable() continue; if (var->isRValueReference()) continue; + if (var->isPointer()) + continue; if (var->isConst()) continue; if (!var->scope()) diff --git a/test/testother.cpp b/test/testother.cpp index ca3972e83..0832facbd 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -2305,6 +2305,13 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + // #10002 + check("using A = int*;\n" + "void f(const A& x) {\n" + " ++(*x);\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + check("void e();\n" "void g(void);\n" "void h(void);\n"