[clang] [clang][Sema] Diagnose exceptions only in non-dependent context in discarded `try/catch/throw` blocks (PR #139859)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue May 27 07:56:42 PDT 2025


================
@@ -9162,6 +9162,8 @@ StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
     Handlers.push_back(Handler.getAs<Stmt>());
   }
 
+  getSema().DiagnoseExceptionUse(S->getTryLoc(), /* IsTry */ true);
----------------
erichkeane wrote:

```suggestion
  getSema().DiagnoseExceptionUse(S->getTryLoc(), /* IsTry=*/ true);
```

https://github.com/llvm/llvm-project/pull/139859


More information about the cfe-commits mailing list