NVIDIA / NVIDIA/cccl

[BUG]: Including cuda/std/atomic disables deprecation warnings in MSVC 2019

Open
#3,019 7 comments 0 reactions 1 assignee Claimed by @miscco 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

Something else

### Component

libcu++

### Describe the bug

If I compile the following simple program using MSVC 2019 (latest)

```c++

#include

struct Foo
{
[[deprecated]] void bar()
{
std::cout << "Bar!" << std::endl;
}
};

int main()
{
Foo foo;
foo.bar();
}
```

I get the following (expected) error: `error C4996: 'Foo::bar': was declared deprecated`. That this is an error and not a warning may have to do with my other compiler flags and is not the issue here. However, if I add the following include to the top of the code:

```c++
#include
```
Then I get no warnings or errors at all and everything goes through.

For comparison, this is not the case if I included `` instead. It also doesn't happen when compiling with either gcc or clang in WSL.

### How to Reproduce

Put the code mentioned above in a cpp source file and compile it with typical flags using MSVC. In case I'm wrong about typical flags, I'm using the following relevant flags: `-std:c++17 -MD -W4 -WX -wd4505 -bigobj -permissive- -wd4003 -wd4127 -wd4324`.

### Expected behavior

I think the problem is self-evident. I would never expect the inclusion of a header from CCCL to have a side effect as big as suppression of deprecation warnings. It took me a fair amount of time to trace this back to CCCL, going through a fair bit of trouble to check the compiler flags and even update the compiler itself.

### Reproduction link

_No response_

### Operating System

Windows 11

### nvidia-smi output

_No response_

### NVCC version

_No response_

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.