Fixed #4085 (tinyxml2 false positives)

This commit is contained in:
Daniel Marjamäki 2012-09-22 16:49:28 +02:00
parent a17f37c67d
commit 37695d44f3
2 changed files with 14 additions and 0 deletions

View File

@ -60,6 +60,10 @@ void CheckClass::constructors()
if (!scope->isClassOrStruct())
continue;
// don't check uninstantiated template classes
if (scope->classDef->strAt(-1) == ">")
continue;
// There are no constructors.
if (scope->numConstructors == 0) {
// If there is a private variable, there should be a constructor..

View File

@ -58,6 +58,7 @@ private:
TEST_CASE(simple3);
TEST_CASE(simple4);
TEST_CASE(simple5); // ticket #2560
TEST_CASE(simple6); // ticket #4085 - uninstantiated template class
TEST_CASE(initvar_with_this); // BUG 2190300
TEST_CASE(initvar_if); // BUG 2190290
@ -268,6 +269,15 @@ private:
ASSERT_EQUALS("", errout.str());
}
void simple6() { // ticket #4085 - uninstantiated template class
check("template <class T> struct A {\n"
" A<T>() { x = 0; }\n"
"private:\n"
" int x;\n"
"};");
ASSERT_EQUALS("", errout.str());
}
void initvar_with_this() {
check("struct Fred\n"
"{\n"