[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:41 PDT 2025


================
@@ -14384,6 +14386,8 @@ TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) {
   if (SubExpr.isInvalid())
     return ExprError();
 
+  getSema().DiagnoseExceptionUse(E->getThrowLoc(), /* IsTry */ false);
----------------
erichkeane wrote:

```suggestion
  getSema().DiagnoseExceptionUse(E->getThrowLoc(), /* IsTry=*/ false);
```

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


More information about the cfe-commits mailing list