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

Add missing <tuple> include #2407

Merged
merged 1 commit into from
Jul 1, 2021
Merged

Conversation

joemmett
Copy link
Contributor

@joemmett joemmett commented Jul 1, 2021

ranges.h needs std::get overloads from <tuple> but does not directly
include it. This causes compilation failures in MSVC with /permissive-.
On other platforms <tuple> is included as a dependency from other headers
(specifically from <memory>), but there is no such implicit dependency in
MSVC's STL.

Fixes #2401

@vitaut
Copy link
Contributor

vitaut commented Jul 1, 2021

Thanks for the PR. fmt/ranges.h shouldn't include <tuple> so the correct fix would be to replace using std::get with using namespace std.

@joemmett
Copy link
Contributor Author

joemmett commented Jul 1, 2021

Would you prefer a using std::get? I see that pattern used already in this file.

@vitaut
Copy link
Contributor

vitaut commented Jul 1, 2021

Would you prefer a using std::get?

If it works then sure.

This replaces the `std::get` call with an unqualified equivalent to allow
it to be treated as a dependent call.

ranges.h needs std::get overloads from `<tuple>` but does not directly
include it. This causes compilation failures in MSVC with /permissive-.
On other platforms `<tuple>` is included as a dependency from other headers
(specifically from `<memory>`), but there is no such implicit dependency in
MSVC's STL.

Fixes fmtlib#2401
@joemmett
Copy link
Contributor Author

joemmett commented Jul 1, 2021

Would you prefer a using std::get?

If it works then sure.

It does, but note that these changes to unqualified get calls will allow ADL to potentially find other gets and that might not always be what you want.

@vitaut vitaut merged commit 889bbf2 into fmtlib:master Jul 1, 2021
@vitaut
Copy link
Contributor

vitaut commented Jul 1, 2021

Thank you!

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

Successfully merging this pull request may close these issues.

[MSVC][permissive-] ranges.h(395,41): error C2672: 'get': no matching overloaded function found
2 participants