Added testcases for #2933 (Postfix operator check fails to warn for structs)

This commit is contained in:
Simon Martin 2011-07-24 14:53:03 +02:00 committed by Daniel Marjamäki
parent 158fa25623
commit 3fa3a53580
1 changed files with 18 additions and 0 deletions

View File

@ -112,6 +112,24 @@ private:
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:7]: (performance) Prefer prefix ++/-- operators for non-primitive types.\n", errout.str()); ASSERT_EQUALS("[test.cpp:7]: (performance) Prefer prefix ++/-- operators for non-primitive types.\n", errout.str());
check("\n"
"struct K {};"
"void foo()\n"
"{\n"
" K k(0);\n"
" k++;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:5]: (performance) Prefer prefix ++/-- operators for non-primitive types.\n", errout.str());
check("\n"
"union K {};"
"void foo()\n"
"{\n"
" K k(0);\n"
" k++;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:5]: (performance) Prefer prefix ++/-- operators for non-primitive types.\n", errout.str());
check("\n" check("\n"
"#include <iostream>\n" "#include <iostream>\n"
"class K {};" "class K {};"