[libcxx-commits] [PATCH] D116381: [libc++][format] Fix precision parser conformance.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jan 2 08:08:37 PST 2022


Mordante marked 2 inline comments as done.
Mordante added inline comments.


================
Comment at: libcxx/test/std/utilities/format/format.functions/format_tests.h:180
+  check_exception(
+      "A format-spec arg-id should terminate at a '}'",
+      STR("hello {0:{01}}"), world, 1);
----------------
Mordante wrote:
> CaseyCarter wrote:
> > Quuxplusone wrote:
> > > It would be friendlier to make this message `"A format-spec arg-id shouldn't have leading zeros"`.
> > > Also (definitely unrelated to this PR) I think it's superfluous to keep repeating the word `format-spec` in all these messages. The exception type is already `format_error` and it's thrown during format-string parsing, right? I think `"An arg-id shouldn't...` would be perfectly unambiguous to the catcher.
> > +1 for "... shouldn't have leading zeroes". A user who mistakenly believes that `01` is a valid _arg-id_ will read this message, see all the `}`s in the format string, and spend an hour investigating the wrong thing / filing a bug report when we could have pointed them directly at the problem.
> @vitaut suggested here https://reviews.llvm.org/D115988#inline-1110797 to simplify all messages. So for now I keep this message as is. If we keep multiple errors it should indeed be a better message, but if we're going to simplify them I rather keep this one as is.
Changing the message requires updating some tests, so I prefer to do it in a separate PR D116495.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116381/new/

https://reviews.llvm.org/D116381



More information about the libcxx-commits mailing list