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

[libc++][format] Should formatter<vec-bool-ref> be default constructible without <format> include? #61314

Closed
JMazurkiewicz opened this issue Mar 9, 2023 · 4 comments
Assignees
Labels
confirmed Verified by a second party libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@JMazurkiewicz
Copy link
Contributor

According to [vector.syn], formatter specialization for vector<bool>::reference should be available in <vector> header and (since it satisfies BasicFormatter) it should be also default constructible.

Repro:

#include <concepts>
#include <vector>

using R = std::vector<bool>::reference;
using F = std::formatter<R>;
static_assert(std::default_initializable<F>);

Expected: correct compilation
Got: failed static assertion, because <format> include is missing
Compiler explorer: https://godbolt.org/z/sW8dM8cvd

@EugeneZelenko EugeneZelenko added clang-format libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. and removed new issue clang-format labels Mar 9, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 9, 2023

@llvm/issue-subscribers-clang-format

@mordante mordante self-assigned this Mar 10, 2023
@mordante mordante added the confirmed Verified by a second party label Mar 10, 2023
@mordante
Copy link
Member

Thanks for the report, this is indeed a bug. I noticed there's no explicit test to verify this works.

@mordante
Copy link
Member

Fixing this is not trivial, <format> depends on <vector> and to fix it <vector> will depend on <format>. I've some refactoring patches to solve the cycle. However this may take a bit of time to land. After that fixing the bug should be trivial.

@mordante
Copy link
Member

mordante commented May 6, 2023

This has been addressed in https://reviews.llvm.org/D149543.

@mordante mordante closed this as completed May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed Verified by a second party libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

4 participants