<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63736>63736</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
std::char_traits specialization of user defined template character type triggers clang 16/trunk warning
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wanghan02
</td>
</tr>
</table>
<pre>
Code as below or on [Compiler Explorer](https://godbolt.org/z/cYEb93zWh) triggers clang 16/trunk warning. It seems only template user defined character type triggers this warning while non-template type won't.
```
#include <string>
template<typename Char>
struct MyChar {
Char m_ch;
MyChar() = default;
};
template<typename Char>
struct std::char_traits<MyChar<Char>> {
using char_type = MyChar<Char>;
static constexpr void assign(char_type& r, const char_type& a) noexcept {
r = a;
}
};
// clang 16/trunk warning: 'char_traits<MyChar<char>>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it. [-Wdeprecated-declarations]
std::basic_string<MyChar<char>, std::char_traits<MyChar<char>>> str;
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlEuP4jgQgH-NuZRAwSYPDjn08JBWmrmNdrQn5NhF4l3HztqVpulfv3KgoZlZtFqEgqnU83NVyRhN6xBrln9h-XYmR-p8qE_StZ10GZ81Xp_rjdcIMkKD1p_AB_AOWP5l4_vBWAywexusDxhYvmW86oiGyMQL43vG963Xjbe08KFlfP_O-F79sWvW4v1Hx_gaKJi2xRBBWelaWBaM7ymM7i84yeCMaxfwG0FE7CN4Z89A2A9WEsIYMYDGo3GoQXUySEUYgM4D3r1SZ-KHJzh1xiI47-Y3J5P2yTvGS1qwbMuyl-uzyK7fy18ujFN21AhMbCIF41omdp8tPnwysUlenewRNp0MN7VIYVQE385JCqz8chEDwKQH_UF1THySXjQZrxIoJrapWjlauimxcns__68kIul0Q-IlgTtQkIYiE5trRLH5sBG7x0THmEBejBK6lNWvRg8pJbNIkowC5V0kfBsCvHqj4dJ8jFc3f4wXEBjfXDThQS4TBefxTeFAj1mlT5hykQ8AE58noC7N-bTrmHgBxssndNSNDuMlmAgah4BKEiaq8Gj1PUE8-gDfwXkC_HuUFshPWqnU00V9qrqTobofl8WB0rSls-AHSpFS90aSTsugQTqdZEPwr0ajnqLIaUJ8kOEMAwbj9TRBJ2MtNAgBe_-KGoyDr19__wbLKkWLHgaLMiL0pg1pMPzxCP4IhhZp0uc_7hXONSorgyTjXUwTf-2ra0M1Mhp1-JiQX5mlaP_RfJ_wih1ECve7-2kqp-dM10KvxVrOsF4WVVUKUfFq1tVFo4ucF-smXxU5rkuFy1yvc3lciQJXvJqZmmdcZGVWLvlKrKpFUSwLhXmzKipZHXnDVhn20tiFta99WmEzE-OIdSFKUcysbNDGaXVy7vAE00vGedqkoU4282ZsI1tl1kSKdy9kyGL9bxwgDqiMtOZ9Apzu4GHR3TbXs433rKNnY7D1T6vZUDc2C-V7xvcpt-vPfAj-T1TE-H6qKDK-nyr-JwAA__8AVfFe">