From c4af80bdc762f0ba5cfba64c58171bb4518e6f7d Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Wed, 29 Nov 2023 16:01:12 +0100 Subject: [PATCH] Add test for #11653 --- test/testclass.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/testclass.cpp b/test/testclass.cpp index 04a3f2f700c..df4a5b531aa 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -6621,6 +6621,17 @@ class TestClass : public TestFixture { ASSERT_EQUALS("[test.cpp:3]: (style, inconclusive) Technically the member function 'S::f' can be const.\n" "[test.cpp:8]: (performance, inconclusive) Technically the member function 'S::g' can be static (but you may consider moving to unnamed namespace).\n", errout.str()); + + checkConst("class C {\n" // #11653 + "public:\n" + " void f(bool b) const;\n" + "};\n" + "void C::f(bool b) const {\n" + " if (b)\n" + " f(false);\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (performance, inconclusive) Technically the member function 'C::f' can be static (but you may consider moving to unnamed namespace).\n", + errout.str()); } void const90() { // #11637