<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132248>132248</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] incorrect formatting of type trait in assigment
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
stmuench
</td>
</tr>
</table>
<pre>
$ cat bug.cpp
```
#include <cstdint>
#include <type_traits>
namespace foo
{
enum class TypeKind : std::uint8_t
{
KindA = 0,
KindB
};
constexpr auto kTypeKind =
#ifdef TYPE_KIND_A
TypeKind::KindA;
#else
TypeKind::KindB;
#endif
namespace detail
{
constexpr auto kBpfMtu = 1512;
constexpr auto kIoSockMtu = 1518;
constexpr std::uint16_t kMTU = std::conditional<kTypeKind == TypeKind::KindA,
std::integral_constant<std::uint16_t, kBpfMtu>,
std::integral_constant<std::uint16_t, kIoSockMtu>>::type::value;
} // namespace detail
} // namespace foo
```
run: `clang-format bug.cpp`
expected formatting:
```
constexpr std::uint16_t kMTU = std::conditional<kTypeKind == TypeKind::KindA,
std::integral_constant<std::uint16_t, kBpfMtu>,
std::integral_constant<std::uint16_t, kIoSockMtu>>::type::value;
```
actual formatting:
```
constexpr std::uint16_t kMTU = std::conditional < kTypeKind == TypeKind::KindA,
std::integral_constant<std::uint16_t, kBpfMtu>,
std::integral_constant < std::uint16_t,
kIoSockMtu >> ::type::value;
```
Worked fine with clang-format-15
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsVVFr4zgQ_jXyy5Agy3bsPPjBiRsopcfB9TjuKciy7GgjS8Yad9t_v8hx06TNwrKwsA8LhgTNzDfzff7k4c6p1kiZk2RDkjLgIx7skDvsRmnEIahs_ZoTFoPgCNXYLkXfE1qQFZ0fWhAWKSP0WEsg0VY4rJVBEt19CuFrL_c4cIVuDtPC8E66ngsJjbX-KN2cAtKMHQjNnYOn114-KFMDiQpwWJOoIFExKoPZHs81AAA-qwASlUAJ2_pDfzIhpiWJZmhhjUP50g_AR7RwvMAv56GbWjbw9P_fd_uH-7_Kva86j3FqP7WaIVkktZPzDJ_TNu9pplbNR-K1RK70mcfH6TZ984jjRCpMQnbC-ph0b_-x4niRl91geyVduNojHB-f_p0qziFhTa1QWcM1ibbX0kTlTQ1OQp8RlEHZDlzvp8bcW2H7qTNh2zdm3go_DXHm7VH84zO8z07_nrke5axEWgIQtiNsB7e0_17GbMtLv9NiGI33IllRoblpF40duov78ZYmX3opUNZwiqMyrZ_rGu7P-zm9n2uFucCR618jnP8Wwe8i3TTMLRBfdnWvvYDw4wr-Z4ejt54yEr4qPMClVRdhEtR5VK-jNQ9kHqYxi7M0TNPgkMcryddNLGi8jmMZSpGuM0oZz-IqS6u0ClTOKEtoxGi4ClmyWq5oHTa8zjhN1lLEMYmp7LjSS62fu6Ud2kA5N8o8jBiLs0DzSmo3bRzGLqcijPkdNOS-blGNrSMx1cqhe0dChXraVleFSQnKCDsMUuCFacA24LWCaeuAMjDtu04aDMZB5wfE3nkhp1vfKjyM1VLYjrCdbzj_LPrBfpECCdtNPBxhu5nKc86-BQAA___g-Dj5">