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

format_as fails when called with certain std::views #3752

Closed
fennewald opened this issue Dec 11, 2023 · 6 comments
Closed

format_as fails when called with certain std::views #3752

fennewald opened this issue Dec 11, 2023 · 6 comments

Comments

@fennewald
Copy link
Contributor

Reproduction

Godbolt link

Summary

A format_as definition that returns a std::views::filter_view, like so:

auto format_as(CodecMask m) {
    return CodecMask::k_codecs | std::views::filter([&](auto c) { return m.has(c); });
}

does not compile:

CodecMask m;
m.add(Codec::H264);

fmt::println("{}", format_as(m)); // valid
fmt::pritnln("{}", m); // invalid

Stack Overflow

I posted this to stack overflow originally, expecting some mistake of my own. People there suggested that this may be a bug with fmt itself, hence this issue. The explanation given there may prove to be of value.

Notes

I expected the most recent commit (274ba26) may have helped, as it appears to be related to this type of issue. It is worth noting the error message changes when tested against 10.1.1 and trunk in godbolt, but both still do fail.

@vitaut
Copy link
Contributor

vitaut commented Dec 19, 2023

There is a simpler repro for the set_debug_format error in #3763 (comment).

@fennewald
Copy link
Contributor Author

Understood, closing as duplicated!

@vitaut vitaut reopened this Dec 20, 2023
@vitaut
Copy link
Contributor

vitaut commented Dec 20, 2023

Let's keep this one open for tracking the issue.

@vitaut
Copy link
Contributor

vitaut commented Dec 23, 2023

The set_debug_format issue is fixed in 3eb3aef but looks like there is another problem.

@Arghnews
Copy link
Contributor

@vitaut This issue should be fixed by #3955

@vitaut
Copy link
Contributor

vitaut commented May 14, 2024

The original repro compiles now: https://godbolt.org/z/ahh86ME13. Thanks @Arghnews for the fix!

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

3 participants