r179035 - <rdar://problem/13540921> Cope with deduced 'auto' in a C++11 for-range loop that is actually an Objective-C fast enumeration loop.

David Blaikie dblaikie at gmail.com
Mon Apr 15 23:43:13 PDT 2013


On Mon, Apr 8, 2013 at 2:20 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Apr 8, 2013, at 2:19 PM, John McCall <rjmccall at apple.com> wrote:
>
> On Apr 8, 2013, at 12:42 PM, Erik Verbruggen <erik.verbruggen at me.com> wrote:
>
> Pardon my ignorance, but why a warning? Or to rephrase it: why could this be
> problematic at all to fail with -Werror?
>
>
> There's no good reason to use "auto" in a situation where it will always
> infer as "id".  People should either explicitly provide a more specific
> type, in which case uses of the value will actually be meaningfully
> type-checked, or they should type "id", which is shorter.
>
>
> … and it's not an error because this could legitimately happen during
> template instantiation, where we suppress the warning.

But if the warning is appropriately suppressed/doesn't fire in
templates, why is that scenario a reason not to have it be an error?




More information about the cfe-commits mailing list