[clang] [clang][Sema] Don't diagnose unevaluated or constant-evaluated device code (PR #244019)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 26 04:54:23 PST 2026


================
@@ -2049,6 +2049,14 @@ class DeferredDiagnosticsEmitter
     }
   }
 
+  // Skip constant expressions evaluated at compile time.
+  void VisitConstantExpr(ConstantExpr *E) {
+    if (E->getResultStorageKind() != ConstantResultStorageKind::None ||
----------------
yxsamliu wrote:

Could we keep checking calls through a `constexpr` function pointer? The address is computed at compile time, but the call still runs on the GPU. This patch emits a call to a host-only function. A pointer returned by `consteval` has the same issue. Could we test both?

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


More information about the cfe-commits mailing list