Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Feb 19, 2024
1 parent 02463cd commit b4ea5f7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ class TestOther : public TestFixture {
" x.dostuff();\n"
" const U& y = (const U&)(x);\n"
"}");
ASSERT_EQUALS("[test.cpp:4]: (style) C-style reference casting\n",
ASSERT_EQUALS("[test.cpp:4]: (style) C-style reference casting\n"
"[test.cpp:2]: (style) Parameter 'x' can be declared as reference to const\n",
errout.str());
check("struct T : public U { void dostuff() const {}};\n"
Expand All @@ -2900,20 +2900,22 @@ class TestOther : public TestFixture {
" U& y = (U&)(x);\n"
" y.mutate();\n" // to avoid warnings that y can be const
"}");
ASSERT_EQUALS("", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (style) C-style reference casting\n", errout.str());
check("struct T : public U { void dostuff() const {}};\n"
"void a(T& x) {\n"
" x.dostuff();\n"
" const U& y = (typename const U&)(x);\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (style) Parameter 'x' can be declared as reference to const\n", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (style) C-style reference casting\n"
"[test.cpp:2]: (style) Parameter 'x' can be declared as reference to const\n",
errout.str());
check("struct T : public U { void dostuff() const {}};\n"
"void a(T& x) {\n"
" x.dostuff();\n"
" U& y = (typename U&)(x);\n"
" y.mutate();\n" // to avoid warnings that y can be const
"}");
ASSERT_EQUALS("", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (style) C-style reference casting\n", errout.str());
check("struct T : public U { void dostuff() const {}};\n"
"void a(T& x) {\n"
" x.dostuff();\n"
Expand Down

0 comments on commit b4ea5f7

Please sign in to comment.