[libcxx-commits] [libcxx] [libc++][format] Improves diagnostics. (PR #127234)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 27 10:09:48 PDT 2025


================
@@ -161,12 +165,11 @@ consteval __arg_t __determine_arg_t() {
 //
 // Modeled after template<class T> explicit basic_format_arg(T& v) noexcept;
 // [format.arg]/4-6
-template <class _Context, class _Tp>
+template <class _Context, __formattable_with<_Context> _Tp>
----------------
ldionne wrote:

If we only add this constraint like you've done here but we don't use `__diagnose_invalid_formatter`, what do we get? I would assume that the compiler machinery for not satisfying a concept should kick in, and it should give us an hopefully fairly reasonable diagnostic? I am a bit concerned to try to replace how the compiler presents concept errors to the user -- it seems that there is no end to the complexity that this can have.

https://github.com/llvm/llvm-project/pull/127234


More information about the libcxx-commits mailing list