From 25033f2ecff44cf4450fa792553eeeab1aacf1a8 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Mon, 10 Jun 2024 21:48:35 +0200 Subject: [PATCH] Partial fix for #12825 FN constParameterReference with container functions --- cfg/std.cfg | 6 +++--- test/cfg/std.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index 0c9293c1cfa..774e4dbf1c7 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -6706,7 +6706,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + @@ -6755,10 +6755,10 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + - + diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index d11d9edb42d..627d2d68bbc 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -5075,3 +5075,14 @@ void constVariablePointer_push_back(std::vector& d, const std::vector& s void constParameterReference_push_back(std::vector& v, std::string& s) { // #12661 v.push_back(s); } + +// cppcheck-suppress constParameterReference +void constParameterReference_assign(std::vector& v, int& r) { + v.assign(5, r); +} + +// cppcheck-suppress constParameterReference +void constParameterReference_insert(std::list& l, int& r) { + l.insert(l.end(), r); + l.insert(l.end(), 5, r); +} \ No newline at end of file