File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1680,6 +1680,27 @@ void CheckUnusedVarImpl::checkStructMemberUsage()
16801680 if (use)
16811681 break ;
16821682 }
1683+ // Class used in template with unknown definition
1684+ if (Token::Match (tok, " %name% <" ) && tok->linkAt (1 )) {
1685+ if (tok->function ())
1686+ continue ;
1687+ if (tok->type () && tok->type ()->classScope )
1688+ continue ;
1689+ const Token *start = tok;
1690+ while (Token::Match (start->previous (), " %name%|::" ))
1691+ start = start->previous ();
1692+ if (mSettings .library .detectContainer (start))
1693+ continue ;
1694+ const Token *end = tok->linkAt (1 );
1695+ for (; tok != end; tok = tok->next ()) {
1696+ if (tok->type () && tok->type ()->classScope == &scope) {
1697+ use = true ;
1698+ break ;
1699+ }
1700+ }
1701+ if (use)
1702+ break ;
1703+ }
16831704 if (tok->variable () != &var)
16841705 continue ;
16851706 if (tok != var.nameToken ()) {
You can’t perform that action at this time.
0 commit comments