Skip to content

Clang-tidy bugprone-unchecked-optional-access doesn't work when #including <iox/optional.hpp> #168310

@dpar39

Description

@dpar39

I just tried this code with clang-tidy built from main and noticed that bugprone-unchecked-optional-access doesn't work. If I comment out the #include <iox/optional.hpp> then it works as expected.

#include <iox/optional.hpp>
#include <optional>
int foo(std::optional<int>& val)
{
  return *val;
}

Verified that this doesn't work with LLVM 21.1.5 as well (i.e. the check doesn't detect the unsafe dereference)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions