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

            Bug ID: 121643
           Summary: Internal compiler error when await_suspend takes
                    default argument
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at nospam dot scs.stanford.edu
                CC: daniel.kruegler at googlemail dot com
  Target Milestone: ---
                CC: daniel.kruegler at googlemail dot com

g++ 15.2.1 returns an internal compiler error when compiling code in which an
awaiter's await_suspend method takes an extra default argument.  Both g++ 14
and clang 20 accept the code without error.

I'm attaching a short example source file that reproduces the problem.  I place
the code for this example in the public domain.  Here's what happens when you
compile it:

$ g++ -std=c++23 -c bug.cc
during RTL pass: expand
bug.cc: In function 'void coroutine(_Z9coroutinev.Frame*)':
bug.cc:34:20: internal compiler error: in make_decl_rtl, at varasm.cc:1459
   34 |   co_await Awaiter{};
      |                    ^
0x26ec391 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2746498 internal_error(char const*, ...)
        ???:0
0x7154cb fancy_abort(char const*, int, char const*)
        ???:0
0xbd7d66 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
0xbd834c expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
0xbebf21 store_expr(tree_node*, rtx_def*, int, bool, bool)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.

Note: I'm not including pre-processed source because I believe it's easy to
reproduce, and when bisecting versions of the compiler you will probably want
to include the exact <coroutine> header that corresponds to that version of the
compiler you are testing.  However, if for any reason you really need the
header files expanded, just let me know on here and I'll include the
-freport-bug output.

Reply via email to