Skip to content

Fix ticket 8442: detect unselectable switch cases - #8815

Open
JeewoongKim wants to merge 1 commit into
cppcheck-opensource:mainfrom
JeewoongKim:fix-8442-unreachable-switch-case
Open

Fix ticket 8442: detect unselectable switch cases#8815
JeewoongKim wants to merge 1 commit into
cppcheck-opensource:mainfrom
JeewoongKim:fix-8442-unreachable-switch-case

Conversation

@JeewoongKim

Copy link
Copy Markdown

ValueFlow already knows the switch condition value in this case,
but the case labels were not checked against it.

This change uses that value to report case labels that cannot be
selected when the switch condition has a known integer value.

Added regression tests for enum and integer cases, unknown
switch values, and nested switches.

@JeewoongKim JeewoongKim changed the title Fix ticket #8442: detect unselectable switch cases Fix ticket 8442: detect unselectable switch cases Aug 29, 2026
@JeewoongKim
JeewoongKim force-pushed the fix-8442-unreachable-switch-case branch from 52f4e2e to f4ca315 Compare August 29, 2026 12:46
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.

1 participant