···11+diff --git a/include/my_char_traits.h b/include/my_char_traits.h
22+new file mode 100644
33+index 00000000..6336bc03
44+--- /dev/null
55++++ b/include/my_char_traits.h
66+@@ -0,0 +1,65 @@
77++/* Copyright (c) 2024, Oracle and/or its affiliates.
88++
99++ This program is free software; you can redistribute it and/or modify
1010++ it under the terms of the GNU General Public License, version 2.0,
1111++ as published by the Free Software Foundation.
1212++
1313++ This program is designed to work with certain software (including
1414++ but not limited to OpenSSL) that is licensed under separate terms,
1515++ as designated in a particular file or component or in included license
1616++ documentation. The authors of MySQL hereby grant you an additional
1717++ permission to link the program and your derivative works with the
1818++ separately licensed software that they have either included with
1919++ the program or referenced in the documentation.
2020++
2121++ This program is distributed in the hope that it will be useful,
2222++ but WITHOUT ANY WARRANTY; without even the implied warranty of
2323++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2424++ GNU General Public License, version 2.0, for more details.
2525++
2626++ You should have received a copy of the GNU General Public License
2727++ along with this program; if not, write to the Free Software
2828++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
2929++
3030++#ifndef MY_CHAR_TRAITS_INCLUDED
3131++#define MY_CHAR_TRAITS_INCLUDED
3232++
3333++#include <cstring>
3434++
3535++template <class CharT>
3636++struct my_char_traits;
3737++
3838++/*
3939++ This is a standards-compliant, drop-in replacement for
4040++ std::char_traits<unsigned char>
4141++ We need this because clang libc++ is removing support for it in clang 19.
4242++ It is not a complete implementation. Rather we implement just enough to
4343++ compile any usage of char_traits<uchar> we have in our codebase.
4444++ */
4545++template <>
4646++struct my_char_traits<unsigned char> {
4747++ using char_type = unsigned char;
4848++ using int_type = unsigned int;
4949++
5050++ static void assign(char_type &c1, const char_type &c2) { c1 = c2; }
5151++
5252++ static char_type *assign(char_type *s, std::size_t n, char_type a) {
5353++ return static_cast<char_type *>(memset(s, a, n));
5454++ }
5555++
5656++ static int compare(const char_type *s1, const char_type *s2, std::size_t n) {
5757++ return memcmp(s1, s2, n);
5858++ }
5959++
6060++ static char_type *move(char_type *s1, const char_type *s2, std::size_t n) {
6161++ if (n == 0) return s1;
6262++ return static_cast<char_type *>(memmove(s1, s2, n));
6363++ }
6464++
6565++ static char_type *copy(char_type *s1, const char_type *s2, std::size_t n) {
6666++ if (n == 0) return s1;
6767++ return static_cast<char_type *>(memcpy(s1, s2, n));
6868++ }
6969++};
7070++
7171++#endif // MY_CHAR_TRAITS_INCLUDED
7272+diff --git a/sql/mdl_context_backup.h b/sql/mdl_context_backup.h
7373+index 89e7e23d..cf9c307e 100644
7474+--- a/sql/mdl_context_backup.h
7575++++ b/sql/mdl_context_backup.h
7676+@@ -28,6 +28,7 @@
7777+ #include <map>
7878+ #include <memory>
7979+8080++#include "my_char_traits.h"
8181+ #include "sql/malloc_allocator.h"
8282+ #include "sql/mdl.h"
8383+8484+@@ -47,7 +48,8 @@ class MDL_context_backup_manager {
8585+ /**
8686+ Key for uniquely identifying MDL_context in the MDL_context_backup map.
8787+ */
8888+- typedef std::basic_string<uchar> MDL_context_backup_key;
8989++ using MDL_context_backup_key =
9090++ std::basic_string<uchar, my_char_traits<uchar>>;
9191+9292+ class MDL_context_backup;
9393+9494+diff --git a/sql/stream_cipher.h b/sql/stream_cipher.h
9595+index 606d4064..358fbb41 100644
9696+--- a/sql/stream_cipher.h
9797++++ b/sql/stream_cipher.h
9898+@@ -28,6 +28,8 @@
9999+ #include <memory>
100100+ #include <string>
101101+102102++#include "my_char_traits.h"
103103++
104104+ /**
105105+ @file stream_cipher.h
106106+107107+@@ -35,7 +37,8 @@
108108+ binary log files.
109109+ */
110110+111111+-typedef std::basic_string<unsigned char> Key_string;
112112++using Key_string =
113113++ std::basic_string<unsigned char, my_char_traits<unsigned char>>;
114114+115115+ /**
116116+ @class Stream_cipher
117117+diff --git a/unittest/gunit/binlogevents/transaction_compression-t.cc b/unittest/gunit/binlogevents/transaction_compression-t.cc
118118+index ba13f979..01af0e3a 100644
119119+--- a/unittest/gunit/binlogevents/transaction_compression-t.cc
120120++++ b/unittest/gunit/binlogevents/transaction_compression-t.cc
121121+@@ -23,6 +23,7 @@
122122+ */
123123+124124+ #include <array>
125125++#include <string>
126126+127127+ #include <gtest/gtest.h>
128128+ #include "libbinlogevents/include/binary_log.h"
129129+@@ -51,14 +52,13 @@ class TransactionPayloadCompressionTest : public ::testing::Test {
130130+ using Managed_buffer_t = Decompressor_t::Managed_buffer_t;
131131+ using Size_t = Decompressor_t::Size_t;
132132+ using Char_t = Decompressor_t::Char_t;
133133+- using String_t = std::basic_string<Char_t>;
134134+ using Decompress_status_t =
135135+ binary_log::transaction::compression::Decompress_status;
136136+ using Compress_status_t =
137137+ binary_log::transaction::compression::Compress_status;
138138+139139+- static String_t constant_data(Size_t size) {
140140+- return String_t(size, (Char_t)'a');
141141++ static std::string constant_data(Size_t size) {
142142++ return std::string(size, (Char_t)'a');
143143+ }
144144+145145+ protected:
146146+@@ -69,7 +69,7 @@ class TransactionPayloadCompressionTest : public ::testing::Test {
147147+ void TearDown() override {}
148148+149149+ static void compression_idempotency_test(Compressor_t &c, Decompressor_t &d,
150150+- String_t data) {
151151++ const std::string &data) {
152152+ auto debug_string = concat(
153153+ binary_log::transaction::compression::type_to_string(c.get_type_code()),
154154+ " ", data.size());
155155+@@ -104,8 +104,8 @@ class TransactionPayloadCompressionTest : public ::testing::Test {
156156+157157+ // Check decompressed data
158158+ ASSERT_EQ(managed_buffer.read_part().size(), data.size()) << debug_string;
159159+- ASSERT_EQ(data, String_t(managed_buffer.read_part().begin(),
160160+- managed_buffer.read_part().end()))
161161++ ASSERT_EQ(data, std::string(managed_buffer.read_part().begin(),
162162++ managed_buffer.read_part().end()))
163163+ << debug_string;
164164+165165+ // Check that we reached EOF
166166+@@ -118,7 +118,7 @@ TEST_F(TransactionPayloadCompressionTest, CompressDecompressZstdTest) {
167167+ for (auto size : buffer_sizes) {
168168+ binary_log::transaction::compression::Zstd_dec d;
169169+ binary_log::transaction::compression::Zstd_comp c;
170170+- String_t data{TransactionPayloadCompressionTest::constant_data(size)};
171171++ std::string data{TransactionPayloadCompressionTest::constant_data(size)};
172172+ TransactionPayloadCompressionTest::compression_idempotency_test(c, d, data);
173173+ c.set_compression_level(22);
174174+ TransactionPayloadCompressionTest::compression_idempotency_test(c, d, data);
175175+@@ -129,7 +129,7 @@ TEST_F(TransactionPayloadCompressionTest, CompressDecompressNoneTest) {
176176+ for (auto size : buffer_sizes) {
177177+ binary_log::transaction::compression::None_dec d;
178178+ binary_log::transaction::compression::None_comp c;
179179+- String_t data{TransactionPayloadCompressionTest::constant_data(size)};
180180++ std::string data{TransactionPayloadCompressionTest::constant_data(size)};
181181+ TransactionPayloadCompressionTest::compression_idempotency_test(c, d, data);
182182+ }
183183+ }