<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54457>54457</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Modules] Stack dump/not `constexpr` while instantiating hidden friend
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JohelEGP
</td>
</tr>
</table>
<pre>
See stack dump at https://godbolt.org/z/zeaqzTPjq. When the return type is the injected-class-name, its evaluation isn't considered a constant expression; see https://godbolt.org/z/zTEvYxx6x. GCC accepts them: https://godbolt.org/z/c7nq4dGE3, https://godbolt.org/z/YzaM56G1G.
`mod.cpp`:
```C++
export module mod;
export template<typename StandardCharT, int N>
struct basic_symbol_text {
template<int N2>
constexpr friend basic_symbol_text operator+(
const basic_symbol_text&, const basic_symbol_text<char, N2>&) noexcept
{
return basic_symbol_text<StandardCharT, 1>{};
}
};
constexpr auto xxx = basic_symbol_text<char, 1>{} + basic_symbol_text<char, 1>{};
```
```C++
export module mod;
export template<typename StandardCharT, int N>
struct basic_symbol_text {
template<int N2>
constexpr friend basic_symbol_text operator+(
const basic_symbol_text&, const basic_symbol_text<char, N2>&) noexcept
{
return basic_symbol_text{};
}
};
constexpr auto xxx = basic_symbol_text<char, 1>{} + basic_symbol_text<char, 1>{};
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztVU1r3DAQ_TXyZYjxyrv2-uBDsrtZKKQEEig5BVmarJXKliPJiZNfX8n7SZM2PRUKBdnWx5vRmzfDuNLitbxBBOsY_w6ibzpgDmrnOkvSc0Iv_dhoUWnlYm02fvUWHmRPb7fXj08xfKuxBVcjGHS98dPXDkHacUu2j8gdijOumLVnLWuQ0AVIZwGfmeqZk7r14JbQ3AHXrZUCDQpg48Kx1gEOnUFrPZCkF2A91U_J3a6e74YhG2JYLxbAOMfOjYQab_WpOc_bp6lYr9JA9TPw3Ru7mmXryTomyZIk5yRLGi1i3nV-Fuz2u9uxIPQijHHXR6aNA4_vFYaPD3CHPz132HSKOSTpImgbRIQbL41gRixqZm5HSb1SX0m62lpaZ3ruoGJW8nv72njS9w4HByTf3QCnbkdjerCGrfhBeHgwElvxgSfdoWFOmzGg-d5wZ_oeT2gWaP7qNF1wH0lAbHkEdAGtxiHkbu_9hD3sy-0jX-_UmQSf3jhfHiQO3pY7tU-2t-9j_Kx3GoZhAJIuf8v7eAV4Sf4Qerx2XyD_6-Wv18s_UReRKFNRpAWLnHQKSzK7uBrrwJLZMqR317x9S2q1z1uWHLj6ObzUUoV2PLZU6dtuu4FaCuFb9zZjUW9U-VOzk67uq5jrxi-Uet5_zjqjQ1v3S2lt7xnQy9l0OsujukTBi0lWpZl4yPJ5UtCs4IXIpllRFQXP5pFiFSob6BNKW3yB0YWf-zAiWdKE0iSdFJMZnaY05pikRV7kVGTzVOQPZJpgw6SKA4_QhSNTjpSqfmP9oZLW2eOh_-fITYujWsG_T1qtTflF16hW6-tovLscuf8ABoE0pA">