Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C4702: unreachable code #65

Open
hanusek opened this issue Feb 27, 2024 · 3 comments
Open

C4702: unreachable code #65

hanusek opened this issue Feb 27, 2024 · 3 comments

Comments

@hanusek
Copy link

hanusek commented Feb 27, 2024

Hello!
I have a problem:

C:\builds\eprotect-platfrom\auth\client\include\nonstd\expected.hpp(2142) : error C2220: the following warning is treated as an error
C:\builds\eprotect-platfrom\auth\client\include\nonstd\expected.hpp(2142) : warning C4702: unreachable code

OS: Windows 2022
Visual Studio 2022 v17.5.0

https://conan.io/center/recipes/expected-lite?version=0.6.3

@subbota-a
Copy link

Me too

@szaszm
Copy link
Contributor

szaszm commented Apr 23, 2024

How does that work? That line is a comment, there is no code there: https://github.com/martinmoene/expected-lite/blob/v0.6.3/include/nonstd/expected.hpp#L2142
Is it any different in your build directory?

@np-c0mp1ete
Copy link

Hello!

Repro:

#include "expected.hpp"

int main()
{
    nonstd::expected<int, int> ei = 0;
    return ei.value();
}

Compile using cl /O2 /W4 /WX main.cpp. expected-lite version is 0.6.3.

Output:

Microsoft (R) C/C++ Optimizing Compiler Version 19.39.33523 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

main.cpp
C:\test\expected.hpp(1803) : error C2220: the following warning is treated as an error
C:\test\expected.hpp(1803) : warning C4702: unreachable code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants