diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index e34bff57d..b6dce8e02 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1401,6 +1401,9 @@ void CheckClass::thisSubtraction() void CheckClass::checkConst() { + if (!_settings->_checkCodingStyle) + return; + for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { if (Token::Match(tok, "class %var% :|{")) diff --git a/lib/checkclass.h b/lib/checkclass.h index 450543050..f507c75c8 100644 --- a/lib/checkclass.h +++ b/lib/checkclass.h @@ -66,6 +66,7 @@ public: } } checkClass.virtualDestructor(); + checkClass.checkConst(); } diff --git a/test/testclass.cpp b/test/testclass.cpp index 958e2380e..a9b853108 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -1518,6 +1518,7 @@ private: // Check.. Settings settings; + settings._checkCodingStyle = true; CheckClass checkClass(&tokenizer, &settings, this); checkClass.checkConst(); }