KEMBAR78
Remove `_NODISCARD_FRIEND` workaround by fsb4000 · Pull Request #4782 · microsoft/STL · GitHub
Skip to content

Conversation

@fsb4000
Copy link
Contributor

@fsb4000 fsb4000 commented Jul 3, 2024

Fixes #4104

I believe the workaround is not needed since CUDA 11.3.0: https://gcc.godbolt.org/z/bPh1av5f9

C:\Dev\STL\playground>type main.cpp
template<int>
struct test {
    int i;
     [[nodiscard]] friend bool operator==(const test& lhs, const test& rhs) {
        return lhs.i == rhs.i;
    }
};

int main() {
    test<1> t1{1};
    test<1> t2{1};
    t1 == t2;
}

C:\Dev\STL\playground>nvcc main.cpp
main.cpp
main.cpp(12): warning C4834: discarding return value of function with [[nodiscard]] attribute

C:\Dev\STL\playground>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Tue_Feb_27_16:28:36_Pacific_Standard_Time_2024
Cuda compilation tools, release 12.4, V12.4.99
Build cuda_12.4.r12.4/compiler.33961263_0

изображение

I used this version Cuda 12.4.0: https://developer.download.nvidia.com/compute/cuda/12.4.0/network_installers/cuda_12.4.0_windows_network.exe

@fsb4000 fsb4000 requested a review from a team as a code owner July 3, 2024 18:07
@fsb4000 fsb4000 changed the title remove _NODISCARD_FRIEND workaround Remove _NODISCARD_FRIEND workaround Jul 3, 2024
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jul 3, 2024
@StephanTLavavej StephanTLavavej self-assigned this Jul 3, 2024
@StephanTLavavej StephanTLavavej removed their assignment Jul 3, 2024
@StephanTLavavej
Copy link
Member

Thanks for doing the archaeology to figure out exactly when this workaround became unnecessary! 😻 This change is super safe because we began requiring CUDA 11.6.0 with #2791 in VS 2022 17.4, two years ago.

@StephanTLavavej StephanTLavavej changed the title Remove _NODISCARD_FRIEND workaround Remove _NODISCARD_FRIEND workaround Jul 3, 2024
Copy link
Contributor

@miscco miscco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mirrors what we are doing in cccl

@StephanTLavavej StephanTLavavej self-assigned this Jul 4, 2024
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 184ce39 into microsoft:main Jul 5, 2024
@StephanTLavavej
Copy link
Member

Thanks for cleaning up this old workaround! 🧹 🪄 😻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Does CUDA 12.4.0 still need _NODISCARD_FRIEND?

3 participants