The following program does not compile with clang++ -std=c++23 -stdlib=libc++:
// clang++ -std=c++23 -stdlib=libc++ formatbug.cc
#include <format>
int
main(int argc, char **argv)
{
  [[maybe_unused]] auto s = std::format("{0:}>" , argc);
}
The compilation error claims I'm trying to evaluate a consteval function on a non constant expression. You can see the errors here:
https://godbolt.org/z/cv48Kbzjv
Is this just a straight-up bizarre bug in the standard library, or am I triggering some kind of weird digraph/trigraph functionality or advanced formatting feature with the character sequence ":}>"?
This is a bug in libc++ that has already been fixed on Clang trunk for upcoming LLVM 19, presumably with this commit based on a cursory glance at the commit log.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With