[libc-commits] [libc] [libc] Template printf_core::Parser to support wchar_t. (PR #222988)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Fri Sep 11 10:52:29 PDT 2026
================
@@ -22,6 +23,22 @@
namespace LIBC_NAMESPACE_DECL {
namespace printf_core {
+template <typename CharT, char ascii_value> struct CharConstant {};
+
+template <char ascii_value> struct CharConstant<char, ascii_value> {
+ LIBC_INLINE_VAR static constexpr char value = ascii_value;
+};
+
+#if defined(LIBC_TYPES_WCHAR_T_IS_UTF32)
+template <char ascii_value> struct CharConstant<wchar_t, ascii_value> {
+ LIBC_INLINE_VAR static constexpr wchar_t value = ascii_value;
----------------
michaelrj-google wrote:
does this need to cast `ascii_value` to `wchar_t`?
https://github.com/llvm/llvm-project/pull/222988
More information about the libc-commits
mailing list