<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60876>60876</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang 16.0.0~rc1] `std::initializer_list` no viable constructor or deduction guide
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mkoncek
</td>
</tr>
</table>
<pre>
Compiling the following code:
```c++
#include <functional>
int main()
{
std::initializer_list {0};
}
```
produces the following error:
```
main.cpp:5:2: error: no viable constructor or deduction guide for deduction of template arguments of 'initializer_list'
std::initializer_list {0};
^
/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/initializer_list:47:11: note: candidate template ignored: could not match 'initializer_list<_E>' against 'int'
class initializer_list
^
/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/initializer_list:66:17: note: candidate function template not viable: requires 0 arguments, but 1 was provided
constexpr initializer_list() noexcept
^
/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/initializer_list:62:17: note: candidate function template not viable: requires 2 arguments, but 1 was provided
constexpr initializer_list(const_iterator __a, size_type __l)
^
1 error generated.
```
(GCC accepts the code)
See also: https://godbolt.org/z/oP76e8YWW
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlUFv4ygUxz_Ny-WpFsaO7Rx8SJPxXlfaw2hPEYYXhx0MXsBtp4f97Cvsph2lHWkOc2hkEQGPB__fezxECHqwRC1s72F73Ig5Xpxvx2_OSvq26Z363h7cOGmj7YDxQnh2xrjH1JNOERR7YEdge6jY-kng9-lbR3mhrTSzIoTicJ6tjNpZYaD48mKwtNpGHIW2wBvgu5eZ-uqD7UJUaaNir62OWhj9TP5kdIgI9T2D-gjF1bg-3pxn7U7eqVlSuJFA3jv_XsPaTSfK5DRBsd9CsedQ7F8XoHX4oEVvCKWzIfpZRufReVSk5kUlDrNWabMfx9wZI42TEZFQ-GEeycaQRoHXt-KA1-tB8Nf1I2yvZHk3Bw-86xPXLsuAd0b3wLtBSuDdU1OdqvLOk7qIeGe0nZ-Adzm_2t40L2EE3l0D_GL87tTFvqyh2Of5iimmHEEprNIqqX6VrwfrPKll1s1GJVscRZSXD2EUh9OXlDa8RjEIbZP4ZPYDJkSURoSA7xZ_HjZVldjUH7O5XpA3SInJmmfJ0tO_s_YUkL0lD_AD9nPEHB9FwMm7B61IvRHBNUHpafLvuSz3Da2jJ0nTp8LEfwcm_tswLZMnHcmLdM9PJ5EcBv1Mp_h9IjydzGvlwpvfK898LR84kE1-SGUf1h3gzR-HAwqZYrJWrKXUXv3_RYTCBJekXmKcQqoNvEthcap3JmbOD8C7Z-Cd-7OuqPn769eNagu1K3ZiQ21e1VXTVFVZbS6t6HdsV5aCVMmJRN4wxnacldvizCTLm41uOeMF45yx3ZaVVVYSP-_YOe-bvOiJNVAyGoU2mTEPY9p7o0OYqa1YU1cbI3oyYXlfOLf0iMskcJ6eG9-mNXf9PAQoWWId3rxEHc3yMEkj7IB5lbGM_edlDtsjQsV-WhWhYr9cnzezN-0NRR0vc59JN6Z8Nw_Xv7vJu39IxpSxSUMA3i0a_w8AAP__teI7OA">