From: Marek Polacek <polacek@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: C++ PATCH for c++/91678 - wrong error with decltype and location wrapper
Date: Sat, 07 Dec 2019 00:19:00 -0000 [thread overview]
Message-ID: <20191207001855.GT119925@redhat.com> (raw)
In-Reply-To: <37c8b1f9-8643-5e89-2bad-af6b76d7b8d1@redhat.com>
[ Sorry for dropping the ball on this. ]
On Tue, Sep 17, 2019 at 11:59:02PM -0400, Jason Merrill wrote:
> On 9/16/19 1:12 PM, Marek Polacek wrote:
> > On Sun, Sep 15, 2019 at 10:18:29AM -0400, Jason Merrill wrote:
> > > On 9/5/19 9:24 PM, Marek Polacek wrote:
> > > > They use
> > > > non_lvalue_loc, but that won't create a NON_LVALUE_EXPR wrapper around a location
> > > > wrapper.
> > >
> > > That seems like the bug. maybe_lvalue_p should be true for
> > > VIEW_CONVERT_EXPR.
> >
> > That makes sense but it breaks in tsubst_* which doesn't expect a
> > NON_LVALUE_EXPR wrapped around a location wrapper.
>
> Hmm, why would we get that in a template when we don't get NON_LVALUE_EXPR
> wrapped around other lvalue nodes?
I just retested the patch without the pt.c hunk and no longer see that problem,
and the fold-const.c hunk still fixes the bogus error. Yay?
So I think the following should be good to go:
Bootstrapped/regtested on x86_64-linux, ok for trunk?
2019-12-06 Marek Polacek <polacek@redhat.com>
PR c++/91678 - wrong error with decltype and location wrapper.
* fold-const.c (maybe_lvalue_p): Handle VIEW_CONVERT_EXPR.
* g++.dg/cpp0x/decltype73.C: New test.
--- gcc/fold-const.c
+++ gcc/fold-const.c
@@ -2594,6 +2594,7 @@ maybe_lvalue_p (const_tree x)
case TARGET_EXPR:
case COND_EXPR:
case BIND_EXPR:
+ case VIEW_CONVERT_EXPR:
break;
default:
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/decltype73.C
@@ -0,0 +1,4 @@
+// PR c++/91678 - wrong error with decltype and location wrapper.
+// { dg-do compile { target c++11 } }
+
+float* test(float* c) { return (decltype(c + 0))(float*)c; }
next prev parent reply other threads:[~2019-12-07 0:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 2:25 Marek Polacek
2019-09-13 2:26 ` Marek Polacek
2019-09-15 14:18 ` Jason Merrill
2019-09-16 18:12 ` Marek Polacek
2019-09-18 3:59 ` Jason Merrill
2019-12-07 0:19 ` Marek Polacek [this message]
2019-12-07 4:03 ` Jason Merrill
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=20191207001855.GT119925@redhat.com \
--to=polacek@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@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).