NVIDIA / NVIDIA/cccl

[BUG]: MSVC < 2022 doesn't properly handle thrust's member function detector.

Open
#1,731 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [X] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Type of Bug

Compile-time Error

### Component

Thrust

### Describe the bug

See reproducer. This works on other platforms and on MSVC 2022, but 2017 and 2019 fire the static assert.

I tried messing with the implementation a little, but no luck finding an alternative that MSVC was happy with.

Some tests in `thrust/testing/memory.cu` and `thrust/testing/allocator.cu` will be disabled until this can be fixed. Search for this issue number to find them.

### How to Reproduce

```
#include

struct foo { void baz(); };

__THRUST_DEFINE_HAS_MEMBER_FUNCTION(has_baz, baz)

static_assert(has_baz::value, "Cannot detect member.");
```

```
> cl.exe -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CPP -IC:\cccl\thrust\ -IC:\cccl\cub\ -IC:\cccl\libcudacxx\include\ -c ..\..\test.cpp

..\..\test.cpp(16): error C2338: Cannot detect member.
```

### Tasks
- [ ] Find a new implementation for the "has member function" utility that work.
- [ ] Re-enable tests in memory.cu (search for this issue number, 1731)
- [ ] Re-enable tests in allocator.cu (search for this issue number, 1731)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.