public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@codesourcery.com>
To: Doug Gregor <doug.gregor@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: PING: C++0x decltype patch
Date: Fri, 27 Jul 2007 17:31:00 -0000	[thread overview]
Message-ID: <46AA2AB7.5050004@codesourcery.com> (raw)
In-Reply-To: <24b520d20707270955u3e8aa8faw2eb52544ba7b3373@mail.gmail.com>

Doug,
> The first sorry(), for BIT_FIELD_REF, should be a gcc_unreachable; it
> just can't happen here. The second "sorry" I'd like to keep... if we
> get here, it means that I somehow missed a particular member-access
> expression node. So, apologize to the user and when they report the
> bug, we'll see what the expression code is to fix the bug. Perhaps
> internal_error would be better?

IMHO that's exactly what
	gcc_assert (TYPE_P (expr) || DECL_P (expr))
is for :)  sorry is for pieces we _know_ we've not implemented.  Here we _think_ 
we've covered all the cases, so an assert is appropriate.

>> here you parse tentatively, but don't appear to be committing to the tentative
>> parse when it succeeds.
> 
> Ah, thanks. The fix is:
> 
>   if (id_expression_or_member_access_p)
>     /* We have parsed the complete id-expression or member access.  */
>     cp_parser_parse_definitely (parser);
>   else
>     {
>       /* Abort our attempt to parse an id-expression or member access
>          expression.  */
>       cp_parser_abort_tentative_parse (parser);
> 
>       /* Parse a full expression.  */
>       expr = cp_parser_expression (parser, /*cast_p=*/false);
>     }
> 
> Essentially, by the time we reach this spot, we've either parsed an
> id-expression or class member access expression, in which case there
> is nothing left to tentatively parse (so we commit); or, we need to
> abort the previous attempts and parse a full expression.

Yup.

> 
>> Also, I can't see where decltype is gated on using c++0x extensions
> 
> In lex.c, if the keyword is only available when in C++0x mode, then
> the feature is only available in C++0x mode:
> 
>   { "decltype",         RID_DECLTYPE,   D_CXX0X },
> 
> That said, decltype can save us (and the compiler) a LOT of work in
> libstdc++, so I would suggest also:
> 
>   { "__decltype",       RID_DECLTYPE,   0 },

I'm fine with this.

> Updated patch attached, with those changes/fixes mention above.
> Regtested powerpc-apple-darwin8.10.0, no regressions. Okay?

I would still like the other sorry turned into gcc_assert, for the reasons I 
mentioned.

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

  reply	other threads:[~2007-07-27 17:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 19:31 Doug Gregor
2007-07-26  7:54 ` Paolo Carlini
2007-07-26  8:04   ` Paolo Carlini
2007-07-26  8:13   ` Andrew Pinski
2007-07-26  9:06     ` Paolo Carlini
2007-07-26 19:29 ` Nathan Sidwell
2007-07-27 17:11   ` Doug Gregor
2007-07-27 17:31     ` Nathan Sidwell [this message]
2007-07-27 18:03       ` Doug Gregor

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=46AA2AB7.5050004@codesourcery.com \
    --to=nathan@codesourcery.com \
    --cc=doug.gregor@gmail.com \
    --cc=gcc-patches@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).