codeql-coding-standards icon indicating copy to clipboard operation
codeql-coding-standards copied to clipboard

`A8-4-9`: Some template functions report variables as not used when they are

Open lcartey opened this issue 1 year ago • 0 comments

Affected rules

  • A8-4-9

Description

We have user reports of this query reporting read and written parameters as "not used". We do not have a reproduction case, but I believe we could start be excluding results on the uninstantiated template, as that copy of the function is "incomplete".

Example

template <typename T>
constexpr void swap(T& lhs, T& rhs) {
  auto temp = std::move(lhs);
  lhs = std::move(rhs);
  rhs = std::move(temp);
}

lcartey avatar Oct 06 '23 08:10 lcartey