On 3/28/21 6:00 PM, Jason McKesson via Std-Proposals wrote:
It should be noted that neither set of code that you presented
constitutes a dangling reference. The temporary manifested by the
default argument will be created by the caller of the function. As
such, the lifetime of that temporary is defined by the location of the
function call, *not* the boundaries of the function scope.

I know, what I have shown is the workaround directly, not the problem.

As such, it is unclear what exactly you want to change about the
language. It's also unclear why you would want to write code this way
instead of just returning the string and letting the *user* call the
function.

What I have shown is one case of the need for the revival of the named return values, but using a workaround. For a proposal, the syntax could use what GCC was using:

https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_5.html#SEC106

Also given the class should abstract all functionality, the user shouldn't need to call the c_str() explicitly.

But again, this proposal is by far not the most urgent one because of the existing workaround but it's only a matter of keeping everything as clean as possible.


    
--

Phil Bouchard
Founder & CTO
C.: (819) 328-4743

Fornux Logo