File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1407,8 +1407,11 @@ void CheckOther::checkPassByReference()
14071407 if (inconclusive && !mSettings ->certainty .isEnabled (Certainty::inconclusive))
14081408 continue ;
14091409
1410+ if (var->isArray () && var->getTypeName () != " std::array" )
1411+ continue ;
1412+
14101413 const bool isConst = var->isConst ();
1411- if (isConst && !var-> isArray () ) {
1414+ if (isConst) {
14121415 passedByValueError (var, inconclusive, isRangeBasedFor);
14131416 continue ;
14141417 }
Original file line number Diff line number Diff line change @@ -2435,8 +2435,10 @@ class TestOther : public TestFixture {
24352435 ASSERT_EQUALS (" " , errout_str ());
24362436
24372437 check (" void f(const std::vector<int> v[2]);\n " // #13052
2438- " int g(const std::array<std::vector<int>, 2> a) { return a[0][0]; }\n " );
2439- ASSERT_EQUALS (" [test.cpp:2]: (performance) Function parameter 'a' should be passed by const reference.\n " , errout_str ());
2438+ " void g(const std::vector<int> v[2]);\n "
2439+ " void g(const std::vector<int> v[2]) {}\n "
2440+ " int h(const std::array<std::vector<int>, 2> a) { return a[0][0]; }\n " );
2441+ ASSERT_EQUALS (" [test.cpp:4]: (performance) Function parameter 'a' should be passed by const reference.\n " , errout_str ());
24402442
24412443 /* const*/ Settings settings1 = settingsBuilder ().platform (Platform::Type::Win64).build ();
24422444 check (" using ui64 = unsigned __int64;\n "
You can’t perform that action at this time.
0 commit comments