public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/103868] ICE at end of coroutine when using asio
Date: Thu, 28 Apr 2022 12:51:26 +0000	[thread overview]
Message-ID: <bug-103868-4-ABXnazULBN@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103868-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:9cb1f565a91e2dd57098c43593954b57c065a19b

commit r12-8307-g9cb1f565a91e2dd57098c43593954b57c065a19b
Author: Nathan Sidwell <nathan@acm.org>
Date:   Sun Apr 3 11:35:03 2022 +0100

    c++, coroutines: Avoid expanding within templates [PR103868]

    This is a forward-port of a patch by Nathan (against 10.x) which fixes an
open
    PR.

    We are ICEing because we ended up tsubst_copying something that had already
    been tsubst, leading to an assert failure (mostly such repeated tsubsting
is
    harmless).

    We had a non-dependent co_await in a non-dependent-type template fn, so we
    processed it at definition time, and then reprocessed at instantiation
time.
    We fix this here by deferring substitution while processing templates.

    Additional observations (for a better future fix, in the GCC13 timescale):

    Exprs only have dependent type if at least one operand is dependent which
was
    what the current code was intending to do.  Coroutines have the additional
    wrinkle, that the current fn's type is an implicit operand.

    So, if the coroutine function's type is not dependent, and the operand is
not
    dependent, we should determine the type of the co_await expression using
the
    DEPENDENT_EXPR wrapper machinery.  That allows us to determine the
    subexpression type, but leave its operand unchanged and then instantiate it
    later.

            PR c++/103868

    gcc/cp/ChangeLog:

            * coroutines.cc (finish_co_await_expr): Do not process
non-dependent
            coroutine expressions at template definition time.
            (finish_co_yield_expr): Likewise.
            (finish_co_return_stmt): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/coroutines/pr103868.C: New test.

    Co-Authored-by: Iain Sandoe <iain@sandoe.co.uk>

  parent reply	other threads:[~2022-04-28 12:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-30 14:55 [Bug c++/103868] New: " ashenglandelbro at protonmail dot com
2021-12-30 14:59 ` [Bug c++/103868] " ashenglandelbro at protonmail dot com
2022-01-03  9:43 ` marxin at gcc dot gnu.org
2022-01-04  8:31 ` marxin at gcc dot gnu.org
2022-01-04  8:32 ` marxin at gcc dot gnu.org
2022-04-18 14:05 ` iains at gcc dot gnu.org
2022-04-28 12:51 ` cvs-commit at gcc dot gnu.org [this message]
2022-04-28 12:58 ` iains at gcc dot gnu.org
2023-05-29 10:06 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103868-4-ABXnazULBN@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).