The point of a constexpr if statement is to determine which branch to
take at compile time, so warning on unreachable code is meaningless in
these situations.
Fixes #57123.
Paths
| Differential D131818
[clang][diagnostics] Don't warn about unreachable code in constexpr if ClosedPublic Authored by ayzhao on Aug 12 2022, 4:45 PM.
Details Summary The point of a constexpr if statement is to determine which branch to Fixes #57123.
Diff Detail
Event TimelineComment Actions Thanks! Can you add a test for non-constexpr unreachable code within the constexpr if and test that that still warns? Comment Actions
Done This revision is now accepted and ready to land.Aug 15 2022, 11:34 AM Closed by commit rGff8aadf58d1a: [clang][diagnostics] Don't warn about unreachable code in constexpr if (authored by ayzhao). · Explain WhyAug 15 2022, 12:24 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 452721 clang/lib/Analysis/ReachableCode.cpp
clang/test/SemaCXX/unreachable-code.cpp
|