[PATCH] D18380: [CUDA] Implement -fcuda-relaxed-constexpr, and enable it by default.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 17:12:08 PDT 2016


jlebar added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:8011-8013
@@ +8010,5 @@
+  // allowed, so we just treat those as host-only.
+  if (getLangOpts().CUDA && getLangOpts().CUDAHostDeviceConstexpr &&
+      NewFD->isConstexpr() && !NewFD->isVariadic() &&
+      !NewFD->hasAttr<CUDAHostAttr>() && !NewFD->hasAttr<CUDADeviceAttr>()) {
+    NewFD->addAttr(CUDAHostAttr::CreateImplicit(Context));
----------------
tra wrote:
> Can we have constexpr `__global__`  ?
Yikes.  We're saved (unless Richard has a tricky counterexample) because kernels must be void and constexpr must not be void.  But I'll add a check here anyway.


http://reviews.llvm.org/D18380





More information about the cfe-commits mailing list