`A2-10-5`: id name reuse false positive with template specialization

Open
#806 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
devtools

Research direction

Start with IdentifierNameOfANonMemberObjectWithExternalOrInternalLinkageIsReused.ql and reproduce the supplied C++ variable-template specialization example. Trace why the specialization is treated as identifier reuse; done means the example no longer produces a warning while genuine identifier reuse remains detected.

Written by the indexing model from the issue text.

Description

Difficulty-Low false positive/false negative Impact-Low user-report
Affected rules
  • A2-10-5
Description

Variable template defined with an specialization is alerted as identifier reuse.

Example
template<typename T, typename S>
extern constexpr bool x = false;

template<typename T>
extern constexpr bool x<T, int> = true;

Query IdentifierNameOfANonMemberObjectWithExternalOrInternalLinkageIsReused.ql warns about x in lines 2 and 5.

Dominant language
CodeQL
Stars
227
Forks
82
Avg merge
6d 7h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/codeql-coding-standards

All issues in github/codeql-coding-standards

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.