We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6ba512d commit 81c113eCopy full SHA for 81c113e
1 file changed
test/testother.cpp
@@ -3981,6 +3981,19 @@ class TestOther : public TestFixture {
3981
" t.s->i = 0;\n"
3982
"}\n");
3983
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
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());
3997
}
3998
3999
void constParameterCallback() {
0 commit comments