Closed
Description
Affected rules
A2-10-5
Description
A2-10-5
requires that non-member objects are given a unique name (irrespective of scope). However, the query does not currently account for variable templates, which are represented as multiple different variables in the CodeQL C/C++ model.
I think the most straightforward fix here is to exclude the variable template instantiations, and only use the un-instantiated template, e.g.:
not o1.isFromTemplateInstantiation(_) and
not o2.isFromTemplateInstantiation(_)
Example
template<class T> constexpr T number_one = T(1);
int test() {
return number_one<int>;
}
long test2() {
return number_one<long>;
}