diff --git a/test/testother.cpp b/test/testother.cpp index dad864205..d80c51147 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -6967,6 +6967,18 @@ private: " return f(s);\n" "}"); ASSERT_EQUALS("", errout.str()); + + // #7981 - False positive redundantCopyLocalConst - const ref argument to ctor + check("class CD {\n" + " public:\n" + " CD(const CD&);\n" + " static const CD& getOne();\n" + "};\n" + " \n" + "void foo() {\n" + " const CD cd(CD::getOne());\n" + "}", nullptr, false, true); + ASSERT_EQUALS("", errout.str()); } void checkNegativeShift() {