From da623c496bbe690e96ad2d9bf7a8ba78e1242429 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:44:31 +0200 Subject: [PATCH 1/2] Update checkother.cpp --- lib/checkother.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index e35e5ccd428..acda9dcf377 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1149,6 +1149,9 @@ bool CheckOther::checkInnerScope(const Token *tok, const Variable* var, bool& us } } } + const auto yield = astContainerYield(tok); + if (yield == Library::Container::Yield::BUFFER || yield == Library::Container::Yield::BUFFER_NT) + return false; } } From c83cfe1d69223019b22d27dda62282665d3a42c7 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:50:20 +0200 Subject: [PATCH 2/2] Update std.cpp --- test/cfg/std.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 627d2d68bbc..9247efaf73a 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -5085,4 +5085,14 @@ void constParameterReference_assign(std::vector& v, int& r) { 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 +} + +const char* variableScope_cstr_dummy(const char* q); // #12812 +std::size_t variableScope_cstr(const char* p) { + std::string s; + if (!p) { + s = "abc"; + p = variableScope_cstr_dummy(s.c_str()); + } + return std::strlen(p); +}