https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98465

--- Comment #41 from Jonathan Wakely <redi at gcc dot gnu.org> ---
So then basically the same as what I said:

(In reply to Jonathan Wakely from comment #37)
> (Your segfaults are probably because you're using c_str() on a temporary
> string, so accessing the pointer after the temporary goes out of scope.)

You're relying on the string contents outliving a specific object, which only
works if the contents are reference-counted and there is still another object
somewhere that owns it. Your code has a bug.

Reply via email to