[libcxx-commits] [PATCH] D144325: [NFC][libc++][format] Improves diagnostics.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 14 10:49:46 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa51e4026900a: [NFC][libc++][format] Improves diagnostics. (authored by Mordante).
Changed prior to commit:
https://reviews.llvm.org/D144325?vs=498572&id=505167#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144325/new/
https://reviews.llvm.org/D144325
Files:
libcxx/include/__format/format_arg_store.h
Index: libcxx/include/__format/format_arg_store.h
===================================================================
--- libcxx/include/__format/format_arg_store.h
+++ libcxx/include/__format/format_arg_store.h
@@ -143,21 +143,24 @@
//
// Note this version can't be constrained avoiding ambiguous overloads.
// That means it can be instantiated by disabled formatters. To solve this, a
-// constrained version for not formattable formatters is added. That overload
-// is marked as deleted to fail creating a storage type for disabled formatters.
+// constrained version for not formattable formatters is added.
template <class _Context, class _Tp>
consteval __arg_t __determine_arg_t() {
return __arg_t::__handle;
}
+// The overload for not formattable types allows triggering the static
+// assertion below.
template <class _Context, class _Tp>
requires(!__formattable<_Tp, typename _Context::char_type>)
-consteval __arg_t __determine_arg_t() = delete;
+consteval __arg_t __determine_arg_t() {
+ return __arg_t::__none;
+}
template <class _Context, class _Tp>
_LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> __create_format_arg(_Tp&& __value) noexcept {
constexpr __arg_t __arg = __determine_arg_t<_Context, remove_cvref_t<_Tp>>();
- static_assert(__arg != __arg_t::__none);
+ static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
// Not all types can be used to directly initialize the
// __basic_format_arg_value. First handle all types needing adjustment, the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144325.505167.patch
Type: text/x-patch
Size: 1529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230314/cf9aaea4/attachment.bin>
More information about the libcxx-commits
mailing list