diff options
author | Michael Liao <michael.hliao@gmail.com> | 2019-09-19 13:14:03 +0000 |
---|---|---|
committer | Michael Liao <michael.hliao@gmail.com> | 2019-09-19 13:14:03 +0000 |
commit | f2fcfddc47faf4ca932ace58ca0df87ca4ef0310 (patch) | |
tree | d78bc96c4e478507dd76550540315848d38a30e2 /test/SemaCUDA/function-overload.cu | |
parent | 23d1a459594f2fcf33a00b355fec6a75b349f38d (diff) | |
download | clang-f2fcfddc47faf4ca932ace58ca0df87ca4ef0310.tar.gz |
[CUDA][HIP] Fix typo in `BestViableFunction`
Summary:
- Should consider viable ones only when checking SameSide candidates.
- Replace erasing with clearing viable flag to reduce data
moving/copying.
- Add one and revise another one as the diagnostic message are more
relevant compared to previous one.
Reviewers: tra
Subscribers: cfe-commits, yaxunl
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67730
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCUDA/function-overload.cu')
-rw-r--r-- | test/SemaCUDA/function-overload.cu | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaCUDA/function-overload.cu b/test/SemaCUDA/function-overload.cu index 1d78636a70..b9efd1c09e 100644 --- a/test/SemaCUDA/function-overload.cu +++ b/test/SemaCUDA/function-overload.cu @@ -402,3 +402,20 @@ __host__ void test_host_template_overload() { __device__ void test_device_template_overload() { template_overload(1); // OK. Attribute-based overloading picks __device__ variant. } + +// Two classes with `operator-` defined. One of them is device only. +struct C1; +struct C2; +__device__ +int operator-(const C1 &x, const C1 &y); +int operator-(const C2 &x, const C2 &y); + +template <typename T> +__host__ __device__ int constexpr_overload(const T &x, const T &y) { + return x - y; +} + +// Verify that function overloading doesn't prune candidate wrongly. +int test_constexpr_overload(C2 &x, C2 &y) { + return constexpr_overload(x, y); +} |