Open
Description
The following invalid program is accepted by clang. Demo
#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.
Clang uses the initializer list ctor over the other default ctor which is not the correct behavior.