[clang-tools-extra] [clang-tidy][NFC] Clarify switch-missing-default-case doc (#164699) (PR #164709)
Keith Thompson via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 22 14:48:39 PDT 2025
Keith-S-Thompson wrote:
Yes, the defined behavior is the same in C++ as it is in C.
Quoting a draft of the ISO C++ standard, section [stmt.switch], emphasis added:
> When the `switch` statement is executed, its condition is evaluated and compared with each case constant. If
one of the case constants is equal to the value of the condition, control is passed to the statement following
the matched case label. If no case constant matches the condition, and if there is a `default` label, control
passes to the statement labeled by the `default` label. **If no case matches and if there is no `default` then none
of the statements in the switch is executed.**
https://github.com/llvm/llvm-project/pull/164709
More information about the cfe-commits
mailing list