diff --git a/cfg/std.cfg b/cfg/std.cfg index 530abcad6..79c5257a9 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -8339,6 +8339,9 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init std::insert_iterator + std::lock_guard + std::unique_lock + std::shared_lock std::pair diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index 5b2ad0751..9a93f9b0a 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -3051,6 +3051,16 @@ private: " std::shared_lock lock( m );\n" "}"); ASSERT_EQUALS("", errout.str()); + + functionVariableUsage("void f() {\n" // #10490 + " std::shared_lock lock = GetLock();\n" + "}"); + ASSERT_EQUALS("", errout.str()); + + functionVariableUsage("void f() {\n" + " auto&& g = std::lock_guard { mutex };\n" + "}\n"); + TODO_ASSERT_EQUALS("", "[test.cpp:2]: (style) Variable 'g' is assigned a value that is never used.\n", errout.str()); } void localvar47() { // #6603