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

fmt: enable compatibility with fmt>=10 #924

Closed
wants to merge 1 commit into from

Conversation

abouvier
Copy link
Contributor

@abouvier abouvier commented Jul 31, 2023

I have no idea what I'm doing, but this seems to compile fine against both fmt9 and fmt10.
fmt10 basically removed implicit conversions for enums.

@abouvier abouvier marked this pull request as draft July 31, 2023 15:53
@abouvier
Copy link
Contributor Author

Well, it failed spectacularly but at least it works with fmt10 :p

@abouvier abouvier force-pushed the fmt10-fix branch 2 times, most recently from 04f269a to 8fc990a Compare August 1, 2023 13:02
@SSimco
Copy link
Contributor

SSimco commented Aug 1, 2023

Wouldn't it be easier to add a generic formatter for enums in Common/precompiled.h instead of adding using fmt::enums::format_as in every namespace?
Something like this (or the one that was commented out in precompiled.h):

template <typename Enum>
requires std::is_enum_v<Enum>
struct fmt::formatter<Enum> : fmt::formatter<underlying_t<Enum>>
{
	auto format(const Enum& e, format_context& ctx) const
	{
		return formatter<underlying_t<Enum>>::format(fmt::underlying(e), ctx);
	}
};

And might as well update vcpkg and use fmt 10.0.0 at this point.

archlinux-github pushed a commit to archlinux/aur that referenced this pull request Aug 5, 2023
This will only work if fmt is below version 10 on your system. If your Arch Linux system is up-to-date, this package currently simply doesn't work - this is being worked on by the Cemu devs. See also: cemu-project/Cemu#924
@abouvier
Copy link
Contributor Author

abouvier commented Aug 7, 2023

It's what fmt::enums::format_as do. But having a generic enum formatter in global namespace causes some errors with fmt9.

@abouvier
Copy link
Contributor Author

abouvier commented Oct 4, 2023

757d458

#919 (comment)

@abouvier abouvier closed this Oct 4, 2023
@abouvier abouvier deleted the fmt10-fix branch October 4, 2023 21:35
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.

2 participants