================
@@ -4304,10 +4304,9 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, 
Stmt *TryBlock,
       getLangOpts().OpenMPIsTargetDevice && (T.isNVPTX() || T.isAMDGCN());
   // Don't report an error if 'try' is used in system headers or in an OpenMP
   // target region compiled for a GPU architecture.
-  if (!IsOpenMPGPUTarget && !getLangOpts().CXXExceptions &&
-      !getSourceManager().isInSystemHeader(TryLoc) && !getLangOpts().CUDA) {
+  if (!IsOpenMPGPUTarget && !getLangOpts().CUDA) {
     // Delay error emission for the OpenMP device code.
-    targetDiag(TryLoc, diag::err_exceptions_disabled) << "try";
+    DiagnoseExceptionUse(TryLoc, /* IsTry */ true);
----------------
erichkeane wrote:

```suggestion
    DiagnoseExceptionUse(TryLoc, /* IsTry= */ true);
```

https://github.com/llvm/llvm-project/pull/139859
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to