[libcxx-commits] [libcxx] [libc++][test] Make narrowing in `nasty_char_traits::to_char_type` more explicit (PR #138375)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 1 03:30:45 PDT 2026
https://github.com/frederick-vs-ja updated https://github.com/llvm/llvm-project/pull/138375
>From a8fc7cefbfe642d6f1c13fe75970ab0d8c51b27c Mon Sep 17 00:00:00 2001
From: "A. Jiang" <de34 at live.cn>
Date: Sat, 3 May 2025 11:06:51 +0800
Subject: [PATCH] [libc++][test] Explicit cast in
`nasty_char_traits::to_char_type`
---
libcxx/test/support/nasty_string.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/test/support/nasty_string.h b/libcxx/test/support/nasty_string.h
index c2968f52e3a00..6b17bbc3f2232 100644
--- a/libcxx/test/support/nasty_string.h
+++ b/libcxx/test/support/nasty_string.h
@@ -70,7 +70,7 @@ struct nasty_char_traits {
static constexpr int_type not_eof(int_type c) noexcept { return eq_int_type(c, eof()) ? ~eof() : c; }
- static constexpr char_type to_char_type(int_type c) noexcept { return char_type(c); }
+ static constexpr char_type to_char_type(int_type c) noexcept { return {static_cast<char>(c)}; }
static constexpr int_type to_int_type(char_type c) noexcept { return int_type(c.c); }
More information about the libcxx-commits
mailing list