From 7f71ad8360071399dbe4d6970eb808686a96b69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 1 Nov 2016 12:25:23 +0100 Subject: [PATCH] Test std::find() --- cfg/std.cfg | 17 ++++++++++++++++- test/cfg/std.cpp | 16 ++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index 9d2fc2c41..168047181 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -4038,13 +4038,28 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + + false + + + + + + + + + + + + + + false diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 89f2c33b1..ac038f840 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -3157,3 +3157,19 @@ void nullPointer_wmemcmp(wchar_t *p) // cppcheck-suppress nullPointer (void)std::wmemcmp(p, 0, 123); } + +/////////////////////////////////////////////////////////////////////// +// +/////////////////////////////////////////////////////////////////////// + +#include +#include + +void stdfind(const std::list &ints1, const std::list &ints2) { + std::list::const_iterator it; + // cppcheck-suppress mismatchingContainers + // cppcheck-suppress ignoredReturnValue + std::find(ints1.begin(), ints2.end(), 123); + // TODO cppcheck-suppress mismatchingContainers + if (std::find(ints1.begin(), ints1.end(), 123) == ints2.end()){} +}