public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Marek Polacek <polacek@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: C++ PATCH for c++/84664, ICE on invalid in lambda
Date: Fri, 02 Mar 2018 17:43:00 -0000	[thread overview]
Message-ID: <CADzB+2=yX33swu0aO1SS+6Ygch7jaqrOyBQVHGJcaDB4FvcNTg@mail.gmail.com> (raw)
In-Reply-To: <20180302173737.GL16833@redhat.com>

OK.

On Fri, Mar 2, 2018 at 12:37 PM, Marek Polacek <polacek@redhat.com> wrote:
> This patch fixes an ICE-on-invalid by checking the result of mark_rvalue_use,
> similarly to perform_implicit_conversion_flags.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2018-03-02  Marek Polacek  <polacek@redhat.com>
>
>         PR c++/84664
>         * typeck.c (cp_perform_integral_promotions): Check the result of
>         mark_rvalue_use.
>
>         * g++.dg/cpp0x/lambda/lambda-ice28.C: New test.
>
> diff --git gcc/cp/typeck.c gcc/cp/typeck.c
> index 0e7c63dd197..f535902231d 100644
> --- gcc/cp/typeck.c
> +++ gcc/cp/typeck.c
> @@ -2161,6 +2161,8 @@ cp_perform_integral_promotions (tree expr, tsubst_flags_t complain)
>    tree promoted_type;
>
>    expr = mark_rvalue_use (expr);
> +  if (error_operand_p (expr))
> +    return error_mark_node;
>
>    /* [conv.prom]
>
> diff --git gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C
> index e69de29bb2d..5fe32129744 100644
> --- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C
> +++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C
> @@ -0,0 +1,9 @@
> +// PR c++/84664
> +// { dg-do compile { target c++11 } }
> +
> +void
> +foo ()
> +{
> +  auto &b = 1; // { dg-error "cannot bind" }
> +  [] { b > 0; }; // { dg-error ".b. is not captured" }
> +}
>
>         Marek

      reply	other threads:[~2018-03-02 17:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-02 17:37 Marek Polacek
2018-03-02 17:43 ` Jason Merrill [this message]

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='CADzB+2=yX33swu0aO1SS+6Ygch7jaqrOyBQVHGJcaDB4FvcNTg@mail.gmail.com' \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@redhat.com \
    /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).