From: Jason Merrill <jason@redhat.com>
To: dev.lists@jessamine.co.uk
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [Patch] [C++0x] Support decltype-specifier as start of nested-name-specifier. (Bug 6709)
Date: Fri, 01 Apr 2011 22:06:00 -0000 [thread overview]
Message-ID: <4D964C5E.9050903@redhat.com> (raw)
In-Reply-To: <624bec8afd68f25f6a4f786c268e3701.squirrel@webmail.plus.net>
Now that we're in stage 1 again, I'd like to get your decltype changes
integrated. Sorry I didn't respond sooner.
On 01/20/2011 11:51 AM, Adam Butcher wrote:
> The attached patch attempts to resolve bug
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709 Allowing
> decltype(expr) to appear as the start of a nested-name-specifier.
>
> However there is something wrong. Although it parses fine, the
> resulting tree seems to be treated as if it were dependent on a template
> parameter. An additional 'typename' prefix is required to get the
> desired behaviour.
>
> Although this seems to work for many scenarios, the resulting tree
> seems to be treated as dependent (in the sense of dependent on a
> template parameter) even when used outside of a template. For
> instance:
>
> struct X {};
> struct Y { typedef X Inner; enum { E = 7 }; };
> Y y;
> decltype(y)::Inner x; // error: 'Inner' does not name a type
It's not that it's treated as dependent; the patch to
cp_parser_simple_type parses the nested-name-specifier, then discards it
and doesn't rewind the input stream, so the later call to
cp_parser_nested_name_specifier doesn't see it and it's as though the
"decltype(y)::" didn't exist.
I think you want to arrange to skip the lower calls to
cp_parser_global_scope_opt and cp_parser_nested_name_specifier in this case.
Do you have tests for your decltype patches?
Jason
next prev parent reply other threads:[~2011-04-01 22:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-20 17:08 Adam Butcher
2011-04-01 22:06 ` Jason Merrill [this message]
2011-07-21 15:59 ` Adam Butcher
2011-07-22 22:17 ` Jason Merrill
2011-07-25 9:20 ` Adam Butcher
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=4D964C5E.9050903@redhat.com \
--to=jason@redhat.com \
--cc=dev.lists@jessamine.co.uk \
--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).