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] Strings are incorrectly aligned when alignment is not specified #58315

Closed
JMazurkiewicz opened this issue Oct 12, 2022 · 2 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

Example:

#include <format>
#include <iostream>

int main() {
    std::cout << std::format("!{:20}!\n", "Hello");
    std::cout << std::format("!{:20}!\n", 3.14159);
}

Expected output:

!Hello               !
!             3.14159!

Got:

!               Hello!
!             3.14159!

Compiler explorer: https://godbolt.org/z/EjfMrE7q5
Specs: [tab:format.align]

@JMazurkiewicz JMazurkiewicz changed the title [libc++] Strings are incorrectly aligned when alignment is not specified [libc++][format] Strings are incorrectly aligned when alignment is not specified Oct 12, 2022
@EugeneZelenko EugeneZelenko added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. and removed new issue labels Oct 12, 2022
@mordante mordante added the confirmed Verified by a second party label Oct 19, 2022
@mordante
Copy link
Member

Thanks for the report! I created a fix https://reviews.llvm.org/D137017

@mordante
Copy link
Member

mordante commented Nov 2, 2022

The fix has landed.

@mordante mordante closed this as completed Nov 2, 2022
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

3 participants