Skip to content

Commit 81c113e

Browse files
Update testother.cpp
1 parent 6ba512d commit 81c113e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/testother.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3981,6 +3981,19 @@ class TestOther : public TestFixture {
39813981
" t.s->i = 0;\n"
39823982
"}\n");
39833983
ASSERT_EQUALS("", errout_str());
3984+
3985+
check("struct B {};\n" // #13877
3986+
"struct D : B { int i; };\n"
3987+
"void f(B& b) {\n"
3988+
" static_cast<D&>(b).i = 0;\n"
3989+
"}\n"
3990+
"void g(B& b) {\n"
3991+
" std::cin >> static_cast<B&>(b).i;\n"
3992+
"}\n"
3993+
"int h(B& b) {\n"
3994+
" return static_cast<const D&>(b).i;\n"
3995+
"}\n");
3996+
ASSERT_EQUALS("[test.cpp:9:10]: (style) Parameter 'b' can be declared as reference to const [constParameterReference]\n", errout_str());
39843997
}
39853998

39863999
void constParameterCallback() {

0 commit comments

Comments
 (0)