public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Rodrigo Rivas <rodrigorivascosta@gmail.com>
Cc: Gabriel Dos Reis <gdr@integrable-solutions.net>,
	Jason Merrill <jason@redhat.com>,
		gcc-patches@gcc.gnu.org
Subject: Re: [C++0x] Range-based for statements and ADL
Date: Tue, 29 Mar 2011 22:00:00 -0000	[thread overview]
Message-ID: <AANLkTik7n-J88BBxpzsntQe5tUZJtmu4kxvod-mqeXVv@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikZQOp5XXQLayf74naa9L9zf1Cp3ma5qX7oM9bu@mail.gmail.com>

On 29 March 2011 21:33, Rodrigo Rivas wrote:
> On Tue, Mar 29, 2011 at 8:22 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> How about "No suitable %<begin%> and %<end%> functions found for range
>> expression of type %qT in %<for%> statement" ?
>
> Nice.
> But the problem here is that there are a lot of different error conditions:
> 1. begin member but not end member.
> 2. end member but not begin member.

I think these cases should say something like "invalid lookup results,
member 'begin' and non-member 'end'" (or vice versa) as we had in last
week's patch.

Or maybe it would be better to say "lookup for 'for' found member
'begin' but no member 'end'"

> 3. begin and end member but one or both are not callable/accesible/whatever.

I would definitely want to get an "access denied", "deleted function"
etc. error for that case.

> 3. no begin/end members, a begin global function but not end.
> 4. no begin/end members, an end global function but not begin.

Maybe something similar to the text I suggested above, but only
mentioning the lookup that failed, "no suitable 'begin' found for
range expression ..."

> 5. no begin/end members, begin and end functions but one or both not
> callable/wrong overload/etc.

In some cases I would probably want to know the actual error, not just
"cannot use range-based for"

If a begin() is found but can't be called, showing the "candidates
are..." list might be helpful to see the problem e.g. if
my::begin(my::type&) can't be called for const my::type.

> 6. no begin/end members, no begin/end global functions. Since the
> standard headers have the std::begin/std::end templates, this will not
> happen when you include (most) STL headers.

Maybe this is the only case where the text I suggested is useful, I
think a special "can't use range-based for" makes sense in this case,
instead of "begin not declared in this scope"

> What is the best message for each? Does it make sense to have up to 6
> different messages? Too many?

It would be nice for users, but it's certainly more work, and
potentially more places for bugs to creep in.

  reply	other threads:[~2011-03-29 21:13 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 [this message]
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
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=AANLkTik7n-J88BBxpzsntQe5tUZJtmu4kxvod-mqeXVv@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdr@integrable-solutions.net \
    --cc=jason@redhat.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).