With this patch, by a constexpr function is implicitly host+device
unless:
a) it's a variadic function (variadic functions are not allowed on the
device side), or
b) it's preceeded by a __device__ overload in a system header.
The restriction on overloading __host__ __device__ functions on the
basis of their CUDA attributes remains in place, but we use (b) to allow
us to define __device__ overloads for constexpr functions in cmath,
which would otherwise be __host__ __device__ and thus not overloadable.
You can disable this behavior with -fno-cuda-host-device-constexpr.
Reviewers: tra, rnk, rsmith
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D18380
llvm-svn: 264964
9 lines
181 B
C++
9 lines
181 B
C++
// This header is used by tests which are interested in __device__ functions
|
|
// which appear in a system header.
|
|
|
|
__device__ int OverloadMe();
|
|
|
|
namespace ns {
|
|
using ::OverloadMe;
|
|
}
|