Skip to content

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 joemmett force-pushed the add_tuple_header branch from 174d097 to 11112ee Compare July 1, 2021 17:06
@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