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

make_unexpected isn't compiled in VS19 C++20 #91

Open
sergeypolkovnikov opened this issue Sep 9, 2021 · 0 comments
Open

make_unexpected isn't compiled in VS19 C++20 #91

sergeypolkovnikov opened this issue Sep 9, 2021 · 0 comments

Comments

@sergeypolkovnikov
Copy link

sergeypolkovnikov commented Sep 9, 2021

environment: Microsoft Visual Studio Enterprise 2019 Version 16.11.2
compiler flag: /std:c++20

the following code is not compiled (in C++17 it compiles successfully)

check::Expected makeError(int const code, std::string description)
{
    return tl::make_unexpected(check::Error{code, std::move(description)});
//  Error	C2440	'return': cannot convert from 'tl::unexpected<E>' to 'tl::expected<check::Success,check::Error>'		
}

definitions:

struct Success
{
};
struct Error
{
    explicit Error(Error&&) = default; // to delete copy ctor
    Error(int code, std::string description) :
        code(code),
        description(std::move(description))
    {}

    int code = 0;
    std::string description;
};
using Expected = tl::expected<Success, Error>;
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

1 participant