<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/102157>102157</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang accepts invalid program when default constructor is overloaded with initializer list constructor that is also a default constructor
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ranaanoop
      </td>
    </tr>
</table>

<pre>
    The following [invalid](https://stackoverflow.com/questions/78836456/overloaded-default-constructor-with-initializer-list-constructor-that-is-also-a) program is accepted by clang. [Demo](https://godbolt.org/z/8nn1Pc3rz)

```
#include <initializer_list>

struct C

    C(){}
 C(std::initializer_list<int> i = {3})
    {
    }  
};

int main()
{
    C d{};   //clang:Ok, gcc:No, MSVC: No, EDG: No
}
```

This is invalid due to ambiguity between the ctors for `()` as explained in this [thread](https://stackoverflow.com/questions/78836456/overloaded-default-constructor-with-initializer-list-constructor-that-is-also-a).

Clang uses the initializer list ctor over the other default ctor which is not the correct behavior.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlM2uqzYQx5_GbEZEYIePLFgk4dJVP6RedVvZeAD3OnZqm6TnPH1l4DS0PQ9wpYhgY__9m_-Mh3uvRoPYkOJCijbhc5isaxw3nBtr74mw8q35OiEMVmv7VGYEUlyUeXCtJClaQusphLsn7ExoR2jnA--_2Qe6Qdvnobc3Qrs_Z_RBWeMJ7aq6ZuWxKAnt4iptuUSZShz4rEPaW-ODm_tgXfpUYUqVUUFxrd7RpVr5f68IEw-p8inX3qac0BPcnR0dv4HywPse7wEliDfoNTfjIZK3eLOfYY9WCqvDwbqR0O6d0K42Jv-lZ-6d0BPJWpKdt2eZbb91SJkyvZ4lAmHXHe7vEZewL_u9Kzlct7nqAusbAMCV0DoeVV1I1W7Tcc4HGSnZ-f_aV2XiCaCAsBZIdWFx6wduFI1qu0EL8HF0S9hlj6ZMgBtXZqP4ANzxgdzY2CWKLbYtxhJ2_vkboVcY-56w8082vv_4629Xws6wjr60P2yDf47_1Mzl-XVSPmZwqzKQM0KwwG9CjbMKbyAwPBENhAkhFoKHwTqIKit8mQH3gH_dNVcGJai4VPmY_zA55N9f4R728V-jqTB79EuEOyWISkvIEBmWzzZM6GDjWL89J9VP0UFjw2qSdQ77AAIn_lDWHRLZMHliJ55gk1eUnorylJfJ1AjGeD4UWc9KkYlCCkGRVzSnhThKKYdENTSjx6zOyrzIalYe6FCJoixZXh2HgdVIjhneuNIHrR-3eJ8S5f2MTZ7RvKgSzQVqv_QbStfyoTS2HtfEDamYR0-OWQzUvySCChqb1Zj1Yr_K4-POPyc0Lx9ebkcjXhmDmJ1PPN2tj9lZOoj2FvhnksnsdPOfBqLCNIutbiL39pfenf0D-0Bot_gQS2mz4tHQvwMAAP___Pq9cQ">