[PATCH] D143750: [clang-tidy] Clarify documention of `bugprone-unchecked-optional-access`.

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 10 09:24:04 PST 2023


xazax.hun added inline comments.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/unchecked-optional-access.rst:278
+
+Given that ``value()`` has well-defined program termination behavior, why treat
+it the same as ``operator*()`` which causes undefined behavior (UB)? That is,
----------------
Strictly speaking, `value` on an empty optional will not terminate the program. It will raise an exception that can be handled.

(Of course, at Google, exceptions are banned so termination is right in that context.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143750/new/

https://reviews.llvm.org/D143750



More information about the cfe-commits mailing list