You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TODO_ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static.\n", "", errout.str());
2630
2635
2631
2636
// functions with a function call to a non-const member can't be const.. (#1305)
@@ -2693,7 +2698,7 @@ class TestClass : public TestFixture {
2693
2698
" std::string s;\n"
2694
2699
" void foo(std::string & a, std::string & b);\n"
2695
2700
"};\n"
2696
-
"void Fred::foo(std::string & a, std::string & b) { s = a; b = s; }");
2701
+
"void Fred::foo(std::string & a, std::string & b) { s = a; b = a; }");
2697
2702
ASSERT_EQUALS("", errout.str());
2698
2703
2699
2704
// assignment to variable, can't be const
@@ -2877,7 +2882,7 @@ class TestClass : public TestFixture {
2877
2882
voidconstoperator1() {
2878
2883
checkConst("struct Fred {\n"
2879
2884
" int a;\n"
2880
-
" bool operator<(const Fred &f) { return (a < f.a); }\n"
2885
+
" bool operator<(const Fred &f) { return a < f.a; }\n"
2881
2886
"};");
2882
2887
ASSERT_EQUALS("[test.cpp:3]: (style, inconclusive) Technically the member function 'Fred::operator<' can be const.\n", errout.str());
2883
2888
}
@@ -3054,15 +3059,15 @@ class TestClass : public TestFixture {
3054
3059
3055
3060
checkConst("class A {\n"
3056
3061
"public:\n"
3057
-
" int foo() { return (x ? x : x = 0); }\n"
3062
+
" int foo() { return x ? x : x = 0; }\n"
3058
3063
"private:\n"
3059
3064
" int x;\n"
3060
3065
"};");
3061
3066
ASSERT_EQUALS("", errout.str());
3062
3067
3063
3068
checkConst("class A {\n"
3064
3069
"public:\n"
3065
-
" int foo() { return (x ? x = 0 : x); }\n"
3070
+
" int foo() { return x ? x = 0 : x; }\n"
3066
3071
"private:\n"
3067
3072
" int x;\n"
3068
3073
"};");
@@ -3355,7 +3360,7 @@ class TestClass : public TestFixture {
3355
3360
3356
3361
checkConst("class A {\n"
3357
3362
"public:\n"
3358
-
" int * const * foo() { return &x; }\n"
3363
+
" int * * foo() { return &x; }\n"
3359
3364
"private:\n"
3360
3365
" const int * x;\n"
3361
3366
"};");
@@ -3615,7 +3620,7 @@ class TestClass : public TestFixture {
3615
3620
3616
3621
checkConst("struct DelayBase {\n"
3617
3622
" float swapSpecificDelays(int index1) {\n"
3618
-
" return static_cast<float>(delays_[index1]);\n"
3623
+
" return delays_[index1];\n"
3619
3624
" }\n"
3620
3625
" float delays_[4];\n"
3621
3626
"};");
@@ -3634,7 +3639,7 @@ class TestClass : public TestFixture {
3634
3639
"double A::dGetValue() {\n"
3635
3640
" double dRet = m_iRealVal;\n"
3636
3641
" if( m_d != 0 )\n"
3637
-
" return dRet / m_d;\n"
3642
+
" return m_iRealVal / m_d;\n"
3638
3643
" return dRet;\n"
3639
3644
"};\n"
3640
3645
);
@@ -4235,7 +4240,7 @@ class TestClass : public TestFixture {
4235
4240
" bool bOn;\n"
4236
4241
" bool foo()\n"
4237
4242
" {\n"
4238
-
" return 0 != (bOn = bOn && true);\n"
4243
+
" return 0 != (bOn = bOn);\n"
4239
4244
" }\n"
4240
4245
"};");
4241
4246
@@ -4449,17 +4454,14 @@ class TestClass : public TestFixture {
0 commit comments