@@ -188,6 +188,7 @@ class TestUnusedVar : public TestFixture {
188188 TEST_CASE (localvarconst2);
189189 TEST_CASE (localvarreturn); // ticket #9167
190190 TEST_CASE (localvarmaybeunused);
191+ TEST_CASE (localvarrvalue); // ticket #13977
191192
192193 TEST_CASE (localvarthrow); // ticket #3687
193194
@@ -5200,10 +5201,9 @@ class TestUnusedVar : public TestFixture {
52005201 " const auto&& c = g();\n "
52015202 " auto&& d = c;\n "
52025203 " }\n " );
5203- TODO_ASSERT_EQUALS (" [test.cpp:5:20]: (style) Variable 'b' is assigned a value that is never used.\n "
5204- " [test.cpp:7:14]: (style) Variable 'd' is assigned a value that is never used. [unreadVariable]\n " ,
5205- " [test.cpp:7:14]: (style) Variable 'd' is assigned a value that is never used. [unreadVariable]\n " ,
5206- errout_str ());
5204+ ASSERT_EQUALS (" [test.cpp:5:19]: (style) Variable 'b' is assigned a value that is never used. [unreadVariable]\n "
5205+ " [test.cpp:7:14]: (style) Variable 'd' is assigned a value that is never used. [unreadVariable]\n " ,
5206+ errout_str ());
52075207 }
52085208
52095209 void localvaralias21 () { // #11728
@@ -6473,6 +6473,15 @@ class TestUnusedVar : public TestFixture {
64736473 ASSERT_EQUALS (" " , errout_str ());
64746474 }
64756475
6476+ void localvarrvalue () { // ticket #13977
6477+ functionVariableUsage (" void f(void) {\n "
6478+ " std::string s;\n "
6479+ " std::string&& m = std::move(s);\n "
6480+ " cb();\n "
6481+ " }\n " );
6482+ ASSERT_EQUALS (" [test.cpp:3:21]: (style) Variable 'm' is assigned a value that is never used. [unreadVariable]\n " , errout_str ());
6483+ }
6484+
64766485 void localvarthrow () { // ticket #3687
64776486 functionVariableUsage (" void foo() {\n "
64786487 " try {}"
0 commit comments