https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71590
--- Comment #4 from gliu <markowitz73 at gmail dot com> --- (In reply to Martin Sebor from comment #3) > There is a (subtle) difference between the initialization in "std::string s > = a;" and the assignment in "std::string s; s = a;" When valid, the > initialization invokes a constructor (possibly two), while the assignment > invokes the assignment operator. But since std::string doesn't have a > constructor that takes just a char (or int) argument the initialization is > invalid. (As mentioned, it does have an assignment operator that takes a > char.) > > (For completeness' sake, in C++ 11, std::string has a constructor that takes > a std::initializer_list, and so with G++ a string object can be constructed > like so: "std::string s = { a };" But this is a G++ extension and not a > valid C++ 11 construct so G++ will give a warning: narrowing conversion of > ‘a’ from ‘int’ to ‘char’ inside { }. understood, thanks for your reply.