diff --git a/cfg/cppcheck-cfg.rng b/cfg/cppcheck-cfg.rng index 84ac7040d..432c84fee 100644 --- a/cfg/cppcheck-cfg.rng +++ b/cfg/cppcheck-cfg.rng @@ -534,6 +534,18 @@ + + + + + + + + + + + + diff --git a/cfg/qt.cfg b/cfg/qt.cfg index 2362b7f3b..f944411a1 100644 --- a/cfg/qt.cfg +++ b/cfg/qt.cfg @@ -5109,6 +5109,12 @@ QApplication QMutexLocker + + QMutex + QRecursiveMutex + QSemaphore + QReadWriteLock + diff --git a/cfg/std.cfg b/cfg/std.cfg index c1d2471d5..9f800dba1 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -8390,6 +8390,10 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init std::basic_ofstream std::pair + + std::mutex + std::recursive_mutex + diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index e72b80b1e..ff4f87252 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -275,7 +275,7 @@ void CheckClass::constructors() } } - if (classNameUsed) + if (classNameUsed && mSettings->library.getTypeCheck("operatorEqVarError", var.getTypeName()) != Library::TypeCheck::suppress) operatorEqVarError(func.token, scope->className, var.name(), missingCopy); } else if (func.access != AccessControl::Private || mSettings->standards.cpp >= Standards::CPP11) { // If constructor is not in scope then we maybe using a constructor from a different template specialization diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 7104bdbc6..0dcf7b4d0 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -1854,6 +1854,17 @@ private: "void Fred::operator=(const Fred &f)\n" "{ }", true); ASSERT_EQUALS("[test.cpp:13]: (warning, inconclusive) Member variable 'Fred::ints' is not assigned a value in 'Fred::operator='.\n", errout.str()); + + Settings s; + s.certainty.setEnabled(Certainty::inconclusive, true); + s.severity.enable(Severity::style); + s.severity.enable(Severity::warning); + LOAD_LIB_2(s.library, "std.cfg"); + check("struct S {\n" + " S& operator=(const S& s) { return *this; }\n" + " std::mutex m;\n" + "};\n", s); + ASSERT_EQUALS("", errout.str()); } void uninitVar1() {