prog.cpp:13:38: error: invalid initialization of non-const reference of type 'std::string& {aka std::basic_string<char>&}' from an rvalue of type 'std::string {aka std::basic_string<char>}'
HasPtr(std::string &s = std::string())
^
prog.cpp: In function 'int main()':
prog.cpp:54:29: error: invalid initialization of non-const reference of type 'std::string& {aka std::basic_string<char>&}' from an rvalue of type 'std::string {aka std::basic_string<char>}'
HasPtr h(std::string("xxx"));
^
prog.cpp:13:2: note: initializing argument 1 of 'HasPtr::HasPtr(std::string&)'
HasPtr(std::string &s = std::string())
^