On Tue, 28 Apr 2020 at 02:26, luo alvin via Gcc <gcc@gcc.gnu.org> wrote: > > Dear gnu: > Here is code:
Please do not report bugs to this mailing list. Bug reports belong in our Bugzilla database, see https://gcc.gnu.org/bugs/ But this is not a bug anyway, your code has undefined behaviour. You cannot use memset on non-trivial objects. Using memset like that overwrites the contents of the std::string with invalid data.