From 7cf558a72df90276f65fdc5cf11429850a0dab89 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 28 Apr 2025 08:46:07 +0200 Subject: [PATCH 1/2] Update astutils.cpp --- lib/astutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 9c869bbcffd..9450cc72978 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -295,7 +295,7 @@ static std::pair getContainerFunction(c if (!tok || !tok->valueType() || (!tok->valueType()->container && (!(cont = library.detectContainerOrIterator(tok->valueType()->smartPointerTypeToken))))) return {}; const Token* parent = tok->astParent(); - if (Token::Match(parent, ". %name% (") && astIsLHS(tok)) { + if (Token::Match(parent, ". %name% [(<]") && astIsLHS(tok)) { return { parent->next(), cont ? cont : tok->valueType()->container }; } return {}; From b74d712abbba6af7af9a1ea128dd217156975274 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 28 Apr 2025 08:48:15 +0200 Subject: [PATCH 2/2] Update teststl.cpp --- test/teststl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/teststl.cpp b/test/teststl.cpp index c005ae125f4..4d1f14ae0f8 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -6956,6 +6956,13 @@ class TestStl : public TestFixture { " s += \'a\';\n" "}\n", dinit(CheckOptions, $.inconclusive = true)); ASSERT_EQUALS("", errout_str()); + + check("void f(std::vector::iterator it) {\n" // #13727 + " std::vector v;\n" + " v.insert::iterator>(v.end(), it, it + 1);\n" + " for (auto i : v) {}\n" + "}\n", dinit(CheckOptions, $.inconclusive = true)); + ASSERT_EQUALS("", errout_str()); } void checkMutexes() {