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