[Bug c++/99831] ICE: in reshape_init, at cp/decl.c:6720

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 31 01:04:30 GMT 2021


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

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The problem is that post-r277865 in defaulted_late_check we call
synthesize_method here:

  if (kind == sfk_comparison)
    {    
      /* If the function was declared constexpr, check that the definition
         qualifies.  Otherwise we can define the function lazily.  */
      if (DECL_DECLARED_CONSTEXPR_P (fn) && !DECL_INITIAL (fn))
        synthesize_method (fn);
      return;
    }

and that results in garbage collection, which then frees {} that we created
when parsing the braced-list in string<"a">{}.  Then of course accessing the
freed data fails.


More information about the Gcc-bugs mailing list