Overload resolution: assignment of empty braces
问题 I wrote some code S s; ... s = {}; , expecting it to end up the same as S s = {}; . However it didn't. The following example reproduces the problem: #include <iostream> struct S { S(): a(5) { } S(int t): a(t) {} S &operator=(int t) { a = t; return *this; } S &operator=(S const &t) = default; int a; }; int main() { S s = {}; S t; t = {}; std::cout << s.a << '\n'; std::cout << t.a << '\n'; } The output is: 5 0 My questions are: Why is operator=(int) selected here, instead of "ambiguous" or the