I have read several topics here and on other resources and did not found exact answer. The answer seems to be never. Please confirm.
Stop. Not never. As noted in Why can you assign nullptr to std::string?:
std::string str {nullptr}; // Undefined behavior So if this will not throw (depends on implementation), c_str() could return (char_t*)nullptr.
I believe there are no other ways to get nullptr from c_str(). But must ask StackOverflow community to be sure. Thanks for attention.
nullptrtostring::stringwill just make the string try to interpret(char*)nullptras a pointer to a c-string. It will still copy the mis-pointed c-string to its managed storagestd::string str {nullptr}; // Undefined behavioras you note, this is undefined behavior, so all bets are off. You can't use something that happens after you invoke undefined behavior as a counter-example.