File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1372,7 +1372,7 @@ void CheckOther::checkPassByReference()
13721372 continue ;
13731373
13741374 const bool isConst = var->isConst ();
1375- if (isConst) {
1375+ if (isConst && !var-> isArray () ) {
13761376 passedByValueError (var, inconclusive, isRangeBasedFor);
13771377 continue ;
13781378 }
Original file line number Diff line number Diff line change @@ -2333,6 +2333,10 @@ class TestOther : public TestFixture {
23332333 " };\n " );
23342334 ASSERT_EQUALS (" " , errout_str ());
23352335
2336+ check (" void f(const std::vector<int> v[2]);\n " // #13052
2337+ " int g(const std::array<std::vector<int>, 2> a) { return a[0][0]; }\n " );
2338+ ASSERT_EQUALS (" [test.cpp:2]: (performance) Function parameter 'a' should be passed by const reference.\n " , errout_str ());
2339+
23362340 /* const*/ Settings settings1 = settingsBuilder ().platform (Platform::Type::Win64).build ();
23372341 check (" using ui64 = unsigned __int64;\n "
23382342 " ui64 Test(ui64 one, ui64 two) { return one + two; }\n " ,
You can’t perform that action at this time.
0 commit comments