From 8317369c9167f65322432a394c92ca13b453fcc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 9 Nov 2015 08:36:47 +0100 Subject: [PATCH] Explicit constructors: don't warn for abstract classes unless C++11 is used. --- lib/checkclass.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 6bf432150..0f49eaef2 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -241,6 +241,11 @@ void CheckClass::checkExplicitConstructors() } } + // Abstract classes can't be instantiated. But if there is "misuse" by derived + // classes then these constructors must be explicit. + if (isAbstractClass && _settings->standards.cpp != Standards::CPP11) + continue; + for (std::list::const_iterator func = scope->functionList.begin(); func != scope->functionList.end(); ++func) { // We are looking for constructors, which are meeting following criteria: