Ah. Yes. It's actually attached now :)<br><br><div class="gmail_quote">On Fri, Jun 8, 2012 at 11:16 AM, Matt Beaumont-Gay <span dir="ltr"><<a href="mailto:matthewbg@google.com" target="_blank">matthewbg@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">ENOPATCH<br>
<div><div class="h5"><br>
On Fri, Jun 8, 2012 at 11:13 AM, Sam Panzer <<a href="mailto:panzer@google.com">panzer@google.com</a>> wrote:<br>
> Hi,<br>
><br>
> Richard Smith suggested that I try to improve the diagnostic emitted when<br>
> Clang encounters certain kinds of invalid C+11 ranged-based for loops.<br>
><br>
>> When a pointer to a container is used as the range in a range-based for,<br>
>> Clang's diagnostic is not awesome:<br>
>><br>
>>> struct S { int *begin(); int *end(); };<br>
>>> void f(S *p) {<br>
>>> for (auto i : p) {}<br>
>>> }<br>
>>> tmp.cpp:3:15: error: use of undeclared identifier 'begin'<br>
>>> for (auto i : p) {} }<br>
>>> ^<br>
>>> tmp.cpp:3:15: note: range has type 'S *'<br>
>><br>
>><br>
>> We should do better than that, and suggest inserting the missing '*'.<br>
><br>
><br>
> This patch replaces the errors complaining about undeclared identifiers with<br>
> an error specific to ranged-for loops, along with an explanatory note. I<br>
> also updated the existing test cases to reflect the change. For example, the<br>
> above code now generates this:<br>
><br>
>> test.cpp:3:15: error: invalid range expression of type 'S *'<br>
>> for (auto i : p) {}<br>
>> ^ ~<br>
>> test.cpp:3:16: note: range expression is of type 'S *'; did you<br>
>> mean to dereference it with '*'?<br>
>> for (auto i : p) {}<br>
>> ^<br>
>> *<br>
>> test.cpp:3:14: note: no viable 'end' function for range of type<br>
>> 'S *'<br>
>> for (auto i : p) {}<br>
><br>
><br>
> I hope that this is helpful, and comments are always welcome.<br>
><br>
> -Sam<br>
><br>
</div></div>> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
</blockquote></div><br>