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

Not compatible with C++20 #458

Closed
F-I-D-O opened this issue May 6, 2020 · 8 comments
Closed

Not compatible with C++20 #458

F-I-D-O opened this issue May 6, 2020 · 8 comments

Comments

@F-I-D-O
Copy link

F-I-D-O commented May 6, 2020

In C++20 std::result_of is removed (Used in App.hpp).

@phlptp phlptp mentioned this issue May 7, 2020
@phlptp
Copy link
Collaborator

phlptp commented May 7, 2020

what compiler are you using that generates an error? and what flags?

@F-I-D-O
Copy link
Author

F-I-D-O commented May 13, 2020

I use Visual Studio 2019 Preview 5.0. But this should be a general issue of all C++20 ready compilers, as std::result of is removed in C++20 (https://en.cppreference.com/w/cpp/types/result_of)

@phlptp
Copy link
Collaborator

phlptp commented May 13, 2020

@F-I-D-O Are you actually getting it to generate an error? I am not able to get an error on the result_of in any compilers I try. I know how to fix it, but I was hoping to see a failing test first.

@F-I-D-O
Copy link
Author

F-I-D-O commented May 14, 2020

Yes:
C:\vcpkg\installed\x64-windows\include\CLI/App.hpp(3055): error C2039: 'result_of': is not a member of 'std'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.26.28801\include\numeric(23): note: see declaration of 'std'
C:\vcpkg\installed\x64-windows\include\CLI/App.hpp(3055): error C2653: 'result_of': is not a class or namespace name
C:\vcpkg\installed\x64-windows\include\CLI/App.hpp(3055): error C3646: 'type': unknown override specifier
C:\vcpkg\installed\x64-windows\include\CLI/App.hpp(3062): error C2039: 'result_of': is not a member of 'std'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.26.28801\include\numeric(23): note: see declaration of 'std'
C:\vcpkg\installed\x64-windows\include\CLI/App.hpp(3062): error C2653: 'result_of': is not a class or namespace name
C:\vcpkg\installed\x64-windows\include\CLI/App.hpp(3062): error C3646: 'type': unknown override specifier

This is a result of compilation of your example code, i.e.:

int main(int argc, char** argv) {
    CLI::App app{"App description"};

    std::string filename = "default";
    app.add_option("-f,--file", filename, "A help string");

    CLI11_PARSE(app, argc, argv);
    return 0;
}

@phlptp
Copy link
Collaborator

phlptp commented May 14, 2020

@F-I-D-O would you mind trying the changed code in #459. Just to make sure? It is enabled for C++14 and higher, but I want to make sure it resolves the error you are seeing.

@F-I-D-O
Copy link
Author

F-I-D-O commented May 14, 2020

I can try it on in a couple of days. Does it mean that I try it with the branch phlptp:cpp20_test? Or something more sophisticated :)

@0vercl0k
Copy link

fwiw @phlptp your changes in #459 fixed this issue for me on VS2019 latest.

@henryiii
Copy link
Collaborator

Please reopen if this is not working on master (that's merged now)!

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