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 to fix ICE with suggestions (PR c++/84537)
Date: Mon, 26 Feb 2018 14:08:00 -0000	[thread overview]
Message-ID: <CADzB+2mbTdj6owh1G2zF_sZU+vm9cYzS2EX+ChssiwyF5N94BA@mail.gmail.com> (raw)
In-Reply-To: <20180226094449.GG2995@redhat.com>

OK.

On Mon, Feb 26, 2018 at 4:44 AM, Marek Polacek <polacek@redhat.com> wrote:
> Here error_mark_node leaks all the way to edit_distance_traits::get_string
> which crashed, so let's not try to give a suggestion for an error node in
> the first place.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2018-02-26  Marek Polacek  <polacek@redhat.com>
>
>         PR c++/84537
>         * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
>         if name is error node.
>
>         * g++.dg/parse/error60.C: New test.
>
> diff --git gcc/cp/name-lookup.c gcc/cp/name-lookup.c
> index 9117e0b30eb..0f00328e96e 100644
> --- gcc/cp/name-lookup.c
> +++ gcc/cp/name-lookup.c
> @@ -5541,6 +5541,10 @@ bool
>  suggest_alternative_in_explicit_scope (location_t location, tree name,
>                                        tree scope)
>  {
> +  /* Something went very wrong; don't suggest anything.  */
> +  if (name == error_mark_node)
> +    return false;
> +
>    /* Resolve any namespace aliases.  */
>    scope = ORIGINAL_NAMESPACE (scope);
>
> diff --git gcc/testsuite/g++.dg/parse/error60.C gcc/testsuite/g++.dg/parse/error60.C
> index e69de29bb2d..38f4e34c59d 100644
> --- gcc/testsuite/g++.dg/parse/error60.C
> +++ gcc/testsuite/g++.dg/parse/error60.C
> @@ -0,0 +1,9 @@
> +// PR c++/84537
> +// { dg-do compile }
> +
> +namespace N
> +{
> +  template<int> struct A {};
> +}
> +
> +N::template A<> a; // { dg-error "" }
>
>         Marek

      reply	other threads:[~2018-02-26 14:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26  9:45 Marek Polacek
2018-02-26 14:08 ` 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+2mbTdj6owh1G2zF_sZU+vm9cYzS2EX+ChssiwyF5N94BA@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).