Skip to content

Commit

Permalink
An attempt to fix clang-tidy false positive #verification #docs #sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed Dec 3, 2024
1 parent 28a2d69 commit 2ee1bfc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/cetl/unbounded_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,9 @@ struct base_access : base_storage<Pmr, Footprint, Alignment>
// Non-PMR storage can store any value as long as it fits into the footprint.
static_assert((Footprint > 0) || IsPmr<Pmr>::value, "Make non-zero footprint, or enable PMR support.");

if (has_value())
// `has_value()` already checks for `value_destroyer_` not being `nullptr`,
// but clang-tidy doesn't see it, so we get false positive here - hence the explicit double check.
if (has_value() && (nullptr != value_destroyer_))
{
value_destroyer_(base::get_raw_storage());
}
Expand Down

0 comments on commit 2ee1bfc

Please sign in to comment.