diff --git a/test/testpostfixoperator.cpp b/test/testpostfixoperator.cpp index d3955ca85..b9d2f10da 100644 --- a/test/testpostfixoperator.cpp +++ b/test/testpostfixoperator.cpp @@ -112,6 +112,24 @@ private: "}\n"); 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" "#include \n" "class K {};"