codeql-coding-standards
codeql-coding-standards copied to clipboard
`A13-3-1`: Ignore false overloads with the same parameter type
Affected rules
-
A13-3-1
Description
getAnOverload()
produces incorrect results when files are extracted multiple times in different contexts. To avoid producing false positives, we should exclude cases where the "overload" has the same parameter type (i.e. an r-value reference type) as the original function being overloaded.
Example
template <typename... T> void suppress_unused_warning(T &&...) {}
was not sure if this had to do with instantiations of the template in the database looking like separate functions,
however, cannot replicate with:
template <typename T> void suppress_unused_warning(T &&...) {}
int test_406() {
suppress_unused_warning(1);
suppress_unused_warning("test");
}
this might have to do with the implicit copy/move constructors... which technically the examples in the rule from the standard doc only show alerts when there are explicit overloads (not involving the implicit copy/move ctors) , so I have chosen to omit those for this