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 constexpr operator"" (PR c++/84325)
Date: Mon, 26 Feb 2018 17:50:00 -0000	[thread overview]
Message-ID: <CADzB+2nCkEEoc-yLT7DDnnjhVzXxbCHGJvFWSq5=NYKgDxqJFw@mail.gmail.com> (raw)
In-Reply-To: <20180226174238.GK2995@redhat.com>

On Mon, Feb 26, 2018 at 12:42 PM, Marek Polacek <polacek@redhat.com> wrote:
> The original testcase was invalid but I added seconds's constructor and made
> time_to_wait inline and now the testcase is accepted by clang++.
>
> But we ICE in replace_placeholders_r because we were checking TREE_CONSTANT
> on a type.  With this patch we accept the code without crashing.  (We require
> time_to_wait to be inline but clang++ does not.)
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2018-02-26  Marek Polacek  <polacek@redhat.com>
>
>         PR c++/84325
>         * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
>         non-types.
>
>         * g++.dg/cpp1z/pr84325.C: New test.
>
> diff --git gcc/cp/tree.c gcc/cp/tree.c
> index 39c1ef28b2d..298517ff83a 100644
> --- gcc/cp/tree.c
> +++ gcc/cp/tree.c
> @@ -3091,7 +3091,7 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
>    replace_placeholders_t *d = static_cast<replace_placeholders_t*>(data_);
>    tree obj = d->obj;
>
> -  if (TREE_CONSTANT (*t))
> +  if (!TYPE_P (*t) && TREE_CONSTANT (*t))

I'd make this

if (TYPE_P (*t) || TREE_CONSTANT (*t))

so we don't keep walking into types.  OK with that change.

Jason

      reply	other threads:[~2018-02-26 17:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 17:42 Marek Polacek
2018-02-26 17:50 ` 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+2nCkEEoc-yLT7DDnnjhVzXxbCHGJvFWSq5=NYKgDxqJFw@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).