Use of a structured binding in an if statement initializer is an automatic violation of the variableScope rule. The scope of entry is already at the if statement, so it can't actually be reduced futher (unless it's counting the if condition clause itself). It doesn't make much sense in the usage though.
Use of a structured binding in an if statement initializer is an automatic violation of the variableScope rule. The scope of entry is already at the if statement, so it can't actually be reduced futher (unless it's counting the if condition clause itself). It doesn't make much sense in the usage though.
test.cpp:6:14: style: The scope of the variable 'entry' can be reduced. [variableScope] if (auto&& [entry, inserted] = m.emplace(1,2); inserted)Last edit: Nicholas Dedekind 2025-11-26
No repro with head, probably fixed by https://github.com/danmar/cppcheck/pull/7521