Skip to content

Commit a3e3f9d

Browse files
committed
Exclude members of uninstantiated templates
We can't properly determine the use of uninstantiated template members without looking at all the instantiated templates. Even then, included templates provide an interface that can be partially used, so alerting on those parts that are currently not used doesn't necessarily indicate a programming mistake.
1 parent 31f5ba4 commit a3e3f9d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cpp/common/src/codingstandards/cpp/deadcode/UnusedVariables.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ class PotentiallyUnusedMemberVariable extends MemberVariable {
9292
// Must be in a fully defined class, otherwise one of the undefined functions may use the variable
9393
getDeclaringType() instanceof FullyDefinedClass and
9494
// Lambda captures are not "real" member variables - it's an implementation detail that they are represented that way
95-
not this = any(LambdaCapture lc).getField()
95+
not this = any(LambdaCapture lc).getField() and
96+
// exclude uninstantiated template members
97+
not this.isFromUninstantiatedTemplate(_)
9698
}
9799
}
98100

0 commit comments

Comments
 (0)