[PATCH] D145408: Fix false positive with unreachable C++ catch handlers

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 6 11:20:14 PST 2023


aaron.ballman created this revision.
aaron.ballman added reviewers: erichkeane, shafik, clang-language-wg.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.

This addresses an issue found by WG21 and tracked by CWG2699 (which is not yet publicly published). The basic problem is that Clang issues a diagnostic about not being able to reach a handler, but that handler *is* reached at runtime. Clang's diagnostic behavior was matching the standard wording, and our runtime behavior was matching the standard's intent.

This fixes the diagnostic so that it matches the runtime behavior more closely, and reduces the number of false positives. This is the direction of choice taken by Core for CWG2699 and it seems unlikely that WG21 will change direction here.

Fixes #61177


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145408

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/test/SemaCXX/unreachable-catch-clauses.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145408.502739.patch
Type: text/x-patch
Size: 8387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230306/cd17d645/attachment.bin>


More information about the cfe-commits mailing list