On 31 March 2011 21:22, Rodrigo Rivas wrote: > On Thu, Mar 31, 2011 at 7:22 PM, Jason Merrill <ja...@redhat.com> 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. >> >>> My guess is that if it is a function >>> (static or non-static) it is called normally, and if it is a member >>> variable it is searched for an operator()(). If it is a type it should >>> fail. >> >> Yes, because we can't use . syntax to name type members. > > Yeah, actually what I meant is whether: > > struct S { typedef int begin, end; }; > //... > for (auto x : S()) ; > > should fall back to ADL or else fail at once. My guess is that is > should fail, but curiously enough my patch does ADL...
Yes, it should fail because the rules for class member access say that if E2 is a nested type then the expression E1.E2 is ill-formed (which is just the formal wording for what Jason said :-)