public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Rodrigo Rivas <rodrigorivascosta@gmail.com>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>,
	       gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [C++0x] Range-based for statements and ADL
Date: Fri, 08 Apr 2011 15:45:00 -0000	[thread overview]
Message-ID: <4D9F2D8B.1010507@redhat.com> (raw)
In-Reply-To: <BANLkTiksTqVsCfuH1OL0N3snASCLdr14zw@mail.gmail.com>

Looks good, just a couple of tweaks:

On 04/06/2011 07:22 PM, Rodrigo Rivas wrote:
> +         error ("range-based %<for%> expression must have complete type");
> +           error ("range-based %<for%> expression has an %<end%> member "
> +                  "but not a %<begin%>");

Let's give the type of the range initializer in these error messages.

> +static tree
> +cp_parser_range_for_member_function (tree range, tree identifier)
> +{
> +  tree member, instance, fn;
> +
> +  member = finish_class_member_access_expr (range, identifier,
> +                                           false, tf_warning_or_error);
> +  if (member == error_mark_node)
> +    return error_mark_node;
> +
> +  if (TREE_CODE (member) == COMPONENT_REF)
> +    {
> +      instance = TREE_OPERAND (member, 0);
> +      fn = TREE_OPERAND (member, 1);
> +    }
> +  else
> +    fn = NULL_TREE;
> +
> +  if (fn && BASELINK_P (fn))
> +    return build_new_method_call (instance, fn,
> +                                   NULL, NULL, LOOKUP_NORMAL,
> +                                   NULL, tf_warning_or_error);
> +  else
> +    {
> +      tree res;
> +      VEC(tree,gc) *vec;
> +
> +      vec = make_tree_vector ();
> +      res = finish_call_expr (member, &vec,
> +                              /*disallow_virtual=*/false,
> +                              /*koenig_p=*/false,
> +                              tf_warning_or_error);
> +      release_tree_vector (vec);
> +      return res;
> +    }
> +}

Instead of handling this difference here, let's teach finish_call_expr 
to handle a COMPONENT_REF around a BASELINK.

Jason

  reply	other threads:[~2011-04-08 15:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTi=-PdaK2bni1d7ucHNNP2nSiDeJrnfET-ueaCvF@mail.gmail.com>
     [not found] ` <AANLkTikxo7955t51av28NhGt4VhA89TyFE6WNPjd_eNE@mail.gmail.com>
     [not found]   ` <AANLkTinP2BzdG+fnO7n=5p+hvaU_VZ+-HyDLNn2Wy2J=@mail.gmail.com>
     [not found]     ` <4D8A2403.5050708@redhat.com>
     [not found]       ` <AANLkTimDRZ94xrA4OPziT7+X-bPK3xfAptTELFpVn-eR@mail.gmail.com>
     [not found]         ` <4D90A209.2020508@redhat.com>
     [not found]           ` <AANLkTintp7fzurBNiiOC+cmRoLt2CF9Q4SwSe04Y1AQa@mail.gmail.com>
     [not found]             ` <AANLkTimWyPccxiYbYG97H9Y6ddHVHFjv+RpgM14tmNyV@mail.gmail.com>
2011-03-29  1:07               ` Rodrigo Rivas
2011-03-29  9:00                 ` Jonathan Wakely
2011-03-29  9:40                   ` Rodrigo Rivas
2011-03-29 15:53                     ` Gabriel Dos Reis
2011-03-29 16:55                       ` Rodrigo Rivas
2011-03-29 18:57                         ` Jonathan Wakely
2011-03-29 20:54                           ` Rodrigo Rivas
2011-03-29 22:00                             ` Jonathan Wakely
2011-03-29 22:55                               ` Rodrigo Rivas
2011-03-31 17:33               ` Jason Merrill
2011-03-31 20:33                 ` Rodrigo Rivas
2011-03-31 20:52                   ` Jonathan Wakely
2011-04-06 23:22                     ` Rodrigo Rivas
2011-04-08 15:45                       ` Jason Merrill [this message]
2011-04-11 20:50                         ` Rodrigo Rivas
2011-04-13 13:46                           ` Jason Merrill
2011-04-14 14:42                             ` Rodrigo Rivas
2011-04-16  3:00                               ` 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=4D9F2D8B.1010507@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=rodrigorivascosta@gmail.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).