M5-3-1
: False positives in unevaluated contexts associated with uninstantiated templates
#851
Labels
Difficulty-Low
A false positive or false negative report which is expected to take <1 day effort to address
false positive/false negative
An issue related to observed false positives or false negatives.
Impact-Medium
Affected rules
M5-3-1
Description
This rule is reporting false positives in unevaluated contexts associated with uninstantiated templates. For example:
noexcept
specifiers of functions.static_assert
s within template functions (not consistently).In these cases, the type of the operand of the boolean operator is
UnknownType
, which is flagged by the query as not boolean.In principle, we should be able to exclude these cases by specifying
not operand.isFromUninstantiatedTemplate(_)
. However, this doesn't apply to e.g.noexcept
specifiers. We also see examples wherestatic_asserts
for the uninstantiated template are orphaned, and not associated with the uninstantiated template.The fix is to exclude operands with the type
UnknownType
.Example
The text was updated successfully, but these errors were encountered: