<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108750>108750</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] conversion operator to builtin _Complex not constexpr
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
willwray
</td>
</tr>
</table>
<pre>
This arose in a generic context:
```c++
struct zero
{
template <typename T>
constexpr operator T() const {return {};}
};
constexpr _Complex float z0{zero{}};
```
`error: constexpr variable 'z0' must be initialized by a constant expression`
This compiler explorer snippet reduces it to a non-template example
https://godbolt.org/z/YPe63E4Gf
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcUkFvozwQ_TXDZdTIGAjhwKFpynf9Dr3saWXDJPHK2Mge0iS_fmVIm2ola8D2vOc3b0bFaE6OqIVqD9UhUzOffWg_jbWfQd0y7Ydb-3E2EVXwkdA4VHgiR8H02HvHdGUoXkEcQHzFrVhXD3Kf1nIaOcw9452Cf6TVjxtEpnGyigmheOPbRE6NhB9QvH8l9N5FpusU0E8UFPuAHyB3IJv1CqHeB-I5uPQH9QGKJT4eWrY_FD7pfr_5cbJ0xaP1ivEuoN4vEleWn8ivqr63FIIPULz-UHdRwShtCUHWdwGyxnGOjDr5Ztgoa-40oL6hWkHKMSYgxWi8e5IvcXG99-NkLIWUZn2ggNGZaSLGQMPcU0TDyB4VOu9evo2kq0p1rURn5immJskOZHfyg_aWNz6cQHZ3kN2v_2lbvJf_Hdf0bGiLoSkalVGb13JbCllWZXZu8-p4lKUuRaWL-rjTDfU7TflQNbRr8q3OTCuFLEWTV7nMy7zc9H291Y0-5iTyYlsOUAoalbEbay9jUpCZGGdqc7GrK5FZpcnGZRSl7K1yJ5AyTWVoE-BFz6cIpbAmcnxSsGG7zO-KqA7J2wuFZOlzXtijno1l455Nd56fzcvmYNt_rDJ8nvWm9yPILr33-LxMwf-hnkF2i_4IsnuUcGnl3wAAAP__oeYKtg">