Talk:cpp/string/basic string/operator=/Archive 1

The g++ 4.8.2 gets confused on the following code (case 4 of basic_string operator=)

and treats the case 4 (a single character as an rvalue to a std::string operator=) as a const char pointer and generates the following errors:

Tomstraub (talk) 05:47, 6 May 2014 (PDT)


 * is not an assignment and does not involve . It is an example of copy-initialization, and gcc is correct in rejecting it. --Cubbi (talk) 05:56, 6 May 2014 (PDT)

operator=(CharT)
As far as I can tell, none of the published standards define this overload. It should probably be marked as a non-standard extension or removed completely. 95.172.145.162 05:52, 10 June 2015 (PDT)
 * it s under 21.4.2[string.cons] (21.3.1/20 in C++98) --Cubbi (talk) 06:15, 10 June 2015 (PDT)
 * Ok, so I was blind. It is both in C++03 and C++11. Sorry.