public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bruno at clisp dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/110149] New: std::format for pointer arguments allows a '0' option Date: Tue, 06 Jun 2023 21:05:04 +0000 [thread overview] Message-ID: <bug-110149-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110149 Bug ID: 110149 Summary: std::format for pointer arguments allows a '0' option Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: bruno at clisp dot org Target Milestone: --- Created attachment 55275 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55275&action=edit test case bug.cc In C++ 20, a sign, a '#' option, and a '0' option are disallowed for std::format strings with a pointer argument. The text has the same language for all three: In https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4950.pdf § 22.14.2.2 Standard format specifiers [format.string.std] Paragraph 5: "The sign option is only valid for arithmetic types other than charT and bool or when an integer presentation type is specified." Paragraph 7: "The # option .... This option is valid for arithmetic types other than charT and bool or when an integer presentation type is specified, and not otherwise." Paragraph 8: "The 0 option is valid for arithmetic types other than charT and bool or when an integer presentation type is specified." Paragraph 21 specifies the available integer presentation types; 'p' is not one of them, it is listed in paragraph 25 instead. Therefore in the attached program bug.cc, an error should be signalled in line 28 and in line 29. How to reproduce: 1) $ g++ -Wall -std=gnu++20 bug.cc <no error> 2) Enable line 18 or line 19 or line 23 or line 24. $ g++ -Wall -std=gnu++20 bug.cc <compilation error> Note also that the '0' option cannot be part of a width specification, because the width cannot start with '0'.
next reply other threads:[~2023-06-06 21:05 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-06 21:05 bruno at clisp dot org [this message] 2023-06-06 22:20 ` [Bug libstdc++/110149] " redi at gcc dot gnu.org 2023-06-06 22:46 ` redi at gcc dot gnu.org 2023-06-06 22:57 ` redi at gcc dot gnu.org 2023-06-08 12:59 ` redi at gcc dot gnu.org 2023-06-09 12:09 ` cvs-commit at gcc dot gnu.org 2023-06-09 12:21 ` redi at gcc dot gnu.org 2023-06-29 23:01 ` cvs-commit at gcc dot gnu.org 2023-06-29 23:02 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-110149-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).