[cfe-dev] objc_selector definition problem

David Chisnall csdavec at swansea.ac.uk
Sun Feb 24 07:07:47 PST 2008


In Sema.cpp, the SEL type is declared as a pointer to a struct  
objc_selector, which is an opaque type.  There seems to be a problem  
defining this.  When compiling a trivial Objective-C program[1] the  
following error appears:

/usr/include/objc/objc.h:63:14: error: incomplete definition of type  
     return s1->sel_id == s2->sel_id;

It appears that the objc_selector type is still treated as opaque,  
even though it is now defined.  The objc.h header contains:

typedef const struct objc_selector
   void *sel_id;
   const char *sel_types;
} *SEL;

inline static BOOL
sel_eq (SEL s1, SEL s2)
   if (s1 == 0 || s2 == 0)
     return s1 == s2;
     return s1->sel_id == s2->sel_id;

The penultimate line in this listing is the one which raises the  
error, even though the objc_selector type is defined immediately  
before the function.

Note: This compiles fine as a C program, where the implicit definition  
of objc_selector is not present.


#include <objc/objc.h>

int main(void)
     return 0;

More information about the cfe-dev mailing list