Re: [C++0x] Range-based for statements and ADL

2011-04-15 Thread Jason Merrill
Applied (with a few formatting tweaks). Thanks, Jason

Re: [C++0x] Range-based for statements and ADL

2011-04-14 Thread Rodrigo Rivas
On Wed, Apr 13, 2011 at 3:46 PM, Jason Merrill wrote: > On 04/11/2011 04:50 PM, Rodrigo Rivas wrote: >> >> Because the type of the expression must have complete type *only* if >> it is an array. > > Actually, if it has class type, it must also have a complete type or the > class member lookup is i

Re: [C++0x] Range-based for statements and ADL

2011-04-13 Thread Jason Merrill
On 04/11/2011 04:50 PM, Rodrigo Rivas wrote: Because the type of the expression must have complete type *only* if it is an array. Actually, if it has class type, it must also have a complete type or the class member lookup is ill-formed. And you can't pass an expression of void type to a fun

Re: [C++0x] Range-based for statements and ADL

2011-04-11 Thread Rodrigo Rivas
On Fri, Apr 8, 2011 at 5:45 PM, Jason Merrill wrote: >> +         error ("range-based % expression must have complete >> type"); >> +           error ("range-based % expression has an % member " >> +                  "but not a %"); > > Let's give the type of the range initializer in these error m

Re: [C++0x] Range-based for statements and ADL

2011-04-08 Thread Jason Merrill
Looks good, just a couple of tweaks: On 04/06/2011 07:22 PM, Rodrigo Rivas wrote: + error ("range-based % expression must have complete type"); + error ("range-based % expression has an % member " + "but not a %"); Let's give the type of the range initializer

Re: [C++0x] Range-based for statements and ADL

2011-04-06 Thread Rodrigo Rivas
Hi! It took some time but I finally re-wrote the patch and added a few testsuites. A few comments as usual: I've moved the array stuff into cp_parser_perform_range_for_lookup. I think that it belongs there: it's just a special lookup case . I finally agreed with Jason about calling lookup_member

Re: [C++0x] Range-based for statements and ADL

2011-03-31 Thread Jonathan Wakely
On 31 March 2011 21:22, Rodrigo Rivas wrote: > On Thu, Mar 31, 2011 at 7:22 PM, Jason Merrill wrote: >> On 03/28/2011 08:28 PM, Rodrigo Rivas wrote: >>> >>> A few comments: >>> 1. I'm not sure about what should happen if the begin/end found in class >>> scope are not ordinary functions. >> >> What

Re: [C++0x] Range-based for statements and ADL

2011-03-31 Thread Rodrigo Rivas
On Thu, Mar 31, 2011 at 7:22 PM, Jason Merrill wrote: > On 03/28/2011 08:28 PM, Rodrigo Rivas wrote: >> >> A few comments: >> 1. I'm not sure about what should happen if the begin/end found in class >> scope are not ordinary functions. > > Whatever range.begin() would mean if written explicitly. >

Re: [C++0x] Range-based for statements and ADL

2011-03-31 Thread Jason Merrill
On 03/28/2011 08:28 PM, Rodrigo Rivas wrote: A few comments: 1. I'm not sure about what should happen if the begin/end found in class scope are not ordinary functions. Whatever range.begin() would mean if written explicitly. My guess is that if it is a function (static or non-static) it is ca

Re: [C++0x] Range-based for statements and ADL

2011-03-29 Thread Rodrigo Rivas
On Tue, Mar 29, 2011 at 11:13 PM, Jonathan Wakely wrote: Thank you for your suggestions! IMO, error cases 3 (hey, two 3s!), 4 and 6 are not so likely, as including any STL container header will make a begin and an end functions declared, though maybe not usabe. In these cases the most probable err

Re: [C++0x] Range-based for statements and ADL

2011-03-29 Thread Jonathan Wakely
On 29 March 2011 21:33, Rodrigo Rivas wrote: > On Tue, Mar 29, 2011 at 8:22 PM, Jonathan Wakely > wrote: >> How about "No suitable % and % functions found for range >> expression of type %qT in % statement" ? > > Nice. > But the problem here is that there are a lot of different error conditions:

Re: [C++0x] Range-based for statements and ADL

2011-03-29 Thread Rodrigo Rivas
On Tue, Mar 29, 2011 at 8:22 PM, Jonathan Wakely wrote: > How about "No suitable % and % functions found for range > expression of type %qT in % 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

Re: [C++0x] Range-based for statements and ADL

2011-03-29 Thread Jonathan Wakely
On 29 March 2011 17:41, Rodrigo Rivas wrote: > > Maybe a simpler error is better. such as: > "expression is not valid as range in a range-based % loop > because it lacks begin/end members or begin(int&) and end(int&) > overloads." (I leave the wording to someone more skilled with > English). If yo

Re: [C++0x] Range-based for statements and ADL

2011-03-29 Thread Rodrigo Rivas
On Tue, Mar 29, 2011 at 5:46 PM, Gabriel Dos Reis wrote: > or "new-style for loop"? Well, that is what they are called in Java, isn't it? And the syntax is just the same, so it would make kind of sense. But in the C++0x draft and the GCC docs it is almost always called "range-based for loops, so I

Re: [C++0x] Range-based for statements and ADL

2011-03-29 Thread Gabriel Dos Reis
On Tue, Mar 29, 2011 at 4:38 AM, Rodrigo Rivas wrote: > On Tue, Mar 29, 2011 at 10:12 AM, Jonathan Wakely > wrote: >> Should we consistently refer to % so the keyword is highlighted? > Now that you say... I've not been quite consistent. We could say > "range-based %", with only a dash between 'r

Re: [C++0x] Range-based for statements and ADL

2011-03-29 Thread Rodrigo Rivas
On Tue, Mar 29, 2011 at 10:12 AM, Jonathan Wakely wrote: > Should we consistently refer to % so the keyword is highlighted? Now that you say... I've not been quite consistent. We could say "range-based %", with only a dash between 'range' and 'based'.

Re: [C++0x] Range-based for statements and ADL

2011-03-29 Thread Jonathan Wakely
On 29 March 2011 01:49, Rodrigo Rivas wrote: > Hi again. > > Here it is my first try at this. I have changed the list to > gcc-patches, I don't know if cross post would be correct. > Please, note that this patch is not finished: the new test cases are > still missing, and expect format mistakes, mi

Re: [C++0x] Range-based for statements and ADL

2011-03-28 Thread Rodrigo Rivas
Hi again. Here it is my first try at this. I have changed the list to gcc-patches, I don't know if cross post would be correct. Please, note that this patch is not finished: the new test cases are still missing, and expect format mistakes, misspellings and the like... A few comments: 1. I'm not