[Bug c++/88554] [9 Regression] Segfault ICE when falling off the end of a reference-returning friend operator

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 19 17:31:00 GMT 2018


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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This fixes the ICE but I don't know if it's right and haven't tested it any
further:

--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -16093,7 +16093,7 @@ finish_function (bool inline_p)
          tree valtype = TREE_TYPE (DECL_RESULT (fndecl));
          if (TREE_CODE (valtype) == REFERENCE_TYPE
              && same_type_ignoring_top_level_qualifiers_p
-                 (TREE_TYPE (valtype), TREE_TYPE (current_class_ref)))
+                 (TREE_TYPE (valtype), current_class_type))
            if (global_dc->option_enabled (OPT_Wreturn_type,
                                           global_dc->option_state))
              add_return_star_this_fixit (&richloc, fndecl);


More information about the Gcc-bugs mailing list