Why does adding two string literals not use operator+(const string&, const string&)?
问题 Edit: I have reformatted the post to be clearer. Why does this work: struct A {}; struct B { B(A){} }; void operator+(const B&, const B&) {} int main() { A a1, a2; a1 + a2; } and this does not? struct B { B(const char*){} }; void operator+(const B&, const B&) {} //error: invalid operands of types 'const char [6]' and 'const char [6]' to binary 'operator+'| int main() { "Hello" + "world"; } Essentially, in the first example a1 and a2 both convert to B objects through the implicit conversion