[PATCH] D18380: [CUDA] Make unattributed constexpr functions (usually) implicitly host+device.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 28 19:39:23 PDT 2016


tra added a comment.

I wonder if we can find a way to decide whether particular constexpr function should be treated as HD or not without relying on particular order the functions are seen by compiler (or whether they come from system headers).

Right now we're relying on checking overloads of constexpr's function decl once and applying HD attributes based on state of overload set at the point in TU. We then use those attributes during overload resolution.

What if instead of permanently sticking HD attributes on the constexpr function, we instead postpone decision to the point of overload resolution and figure out effective attributes or call preference based on contents of the whole overload set regardless of the order the decls were added to the set.


================
Comment at: test/SemaCUDA/host-device-constexpr.cu:30-31
@@ +29,4 @@
+namespace ns {
+// The "using" statement in overload.h should this OverloadMe from being
+// implicitly host+device.
+constexpr HostReturnTy OverloadMe() { return HostReturnTy(); }
----------------
"should prevent this"


http://reviews.llvm.org/D18380





More information about the cfe-commits mailing list