Skip to content

Enable bugprone-unchecked-optional-access clang-tidy check #1872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

bavulapati
Copy link
Contributor

@jviotti We are currently using assert before consuming std::optional's value.
The assert won't be present in production builds.
How should we handle this case? What to do in the case where optional doesn't have value?

Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
@jviotti
Copy link
Member

jviotti commented Jul 22, 2025

Unless there is a case I missed and escaped the tests (could be?), I only assert when I'm sure that the optional is set because of some other pre-conditions, etc

Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
@bavulapati
Copy link
Contributor Author

@jviotti PTAL

Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants