Open
Description
Affected rules
- A2-10-1
- RULE-5-3
- M0-1-3
Description
the extractor creates local variables for each identifier, and one for the entire binding. The later is of type tuple without a name, so it gets (null) .
This means if you have another structured binding later on, the rule is falsely triggered because the name is the same.
Example
#include <tuple>
void f9(int x, int y){
auto tup = std::make_tuple(1, 2);
const auto & [ a, b ] = tup;
const auto & [ c, d ] = tup;
}
this example will require additional stubbing to be added to the tuple.h stub, as it currently will not compile due to tuples in that stub not currently having elements. Compilation error message: error: type 'const std::tuple<int, int>' decomposes into 0 elements, but 2 names were provided
(ie needs to have mechanism to have elements and get those elements)
another example is the current finding in openpilot- dmonitoring.cc:82:10 from query IdentifierHiding.ql
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Triaged