[PATCH] D61458: [hip] Relax CUDA call restriction within `decltype` context.

Hal Finkel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 19:05:27 PDT 2019


hfinkel added a comment.

In D61458#1488970 <https://reviews.llvm.org/D61458#1488970>, @jlebar wrote:

> Here's one for you:
>
>   __host__ float bar();
>   __device__ int bar();
>   __host__ __device__ auto foo() -> decltype(bar()) {}
>
>
> What is the return type of `foo`?  :)
>
> I don't believe the right answer is, "float when compiling for host, int when compiling for device."


So, actually, I wonder if that's not the right answer. We generally allow different overloads to have different return types. What if, for example, the return type on the host is __float128 and on the device it's `MyLongFloatTy`?

> I'd be happy if we said this was an error, so long as it's well-defined what exactly we're disallowing.  But I bet @rsmith can come up with substantially more evil testcases than this.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61458/new/

https://reviews.llvm.org/D61458





More information about the cfe-commits mailing list