[cfe-commits] r79050 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/SemaObjC/blocks.m

Daniel Dunbar daniel at zuster.org
Mon Aug 17 23:38:59 PDT 2009


I don't get the use of selector (or other special wording) at all,
actually. I would expect "similar" warnings for the two loops in this:
--
void f0(id X) {
  for (void i(void) = 0; i != 0; ++i) {}

  for (void i(void) in X) {}
}
--
assuming the compiler didn't crash on this code, of course. :)

This example doesn't crash:
--
void f0(id X) {
  for (void i = 0; i != 0; ++i) {}

  for (void i in X) {}
}
--
but does show horrible warnings. :)
--
ddunbar at giles:tmp$ clang t.m
t.m:2:13: error: variable has incomplete type 'void'
  for (void i = 0; i != 0; ++i) {}
            ^
t.m:2:13: error: variable has incomplete type 'void'
  for (void i = 0; i != 0; ++i) {}
            ^
t.m:4:13: error: variable has incomplete type 'void'
  for (void i in X) {}
            ^
t.m:4:3: error: selector element type 'void' is not a valid object
  for (void i in X) {}
  ^    ~~~~~~~~~
4 diagnostics generated.
--

 - Daniel

On Mon, Aug 17, 2009 at 8:18 AM, Fariborz Jahanian<fjahanian at apple.com> wrote:
>
> On Aug 16, 2009, at 8:57 PM, Chris Lattner wrote:
>
>>
>> On Aug 16, 2009, at 9:52 AM, Fariborz Jahanian wrote:
>>
>>>>
>>>>
>>>> Also, I think we should fix the warning for a real type mismatch to be
>>>> more meaningful. Selector element mismatch doesn't make any sense...
>>>
>>> I think the term came from the instigator of the foreach statement,
>>> which probably came from
>>> Ruby. Yes, it is confusing with objc's selector name. Do you have a
>>> suggestion?
>>>
>>
>> How about "range specifier" ?
>
> Variable  'selects' an object from a collection of objects. Do you think
> 'range specifier' conveys
> the same meaning? How about 'collection selector' (or a synonym for selector
> if there is one)?
>
> - fariborz
>
>>
>>
>> -Chris
>
>




More information about the cfe-commits mailing list