[libcxx-commits] [libcxx] [libc++][format] Decay character arrays in formatting (PR #116571)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 26 14:09:56 PST 2024


================
@@ -101,20 +101,14 @@ consteval __arg_t __determine_arg_t() {
   return __arg_t::__long_double;
 }
 
-// Char pointer
+// Char pointer or array
 template <class _Context, class _Tp>
-  requires(same_as<typename _Context::char_type*, _Tp> || same_as<const typename _Context::char_type*, _Tp>)
+  requires(same_as<typename _Context::char_type*, _Tp> || same_as<const typename _Context::char_type*, _Tp>) ||
+          (is_array_v<_Tp> && same_as<_Tp, typename _Context::char_type[extent_v<_Tp>]>)
----------------
ldionne wrote:

Doesn't this form the invalid type `_Context::char_type[0]` if `_Tp` is not an array (because `extent_v<_Tp>` will then be 0)?

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


More information about the libcxx-commits mailing list