Skip to content

IncludeCleaner's filtering of UsingShadows is too aggressive with templates #59147

@sam-mccall

Description

@sam-mccall
// foo.cpp
using std::vector;
vector<int> x;

The using-decl should be marked as a reference to either vector<T> or vector<int>, but is not.

The reason is that (in an implementation file) we iterate over the UsingShadowDecls and drop those whose targets are not Used or Referenced. In this case the UsingShadowDecl points at the primary template vector<T> but only the specialization vector<int> is marked as used.

Possible fixes:

  • change the AST to also mark the primary template as referenced/used
  • change the logic to query all template specializations when the target is a templatedecl
  • drop this filtering approach to UsingDecls (we already don't use it for headers)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions