Compiler error in NSManagedObject+MagicalDataImport #380

prisonerjohn opened this Issue Jan 11, 2013 · 4 comments


None yet

3 participants


In the function - (BOOL) MR_importValuesForKeysWithObject:(id)objectData, the line typeof(self) weakself = self; does not compile.

It's throwing the warning:

Implicit declaration of function 'typeof' is invalid in C99

And the error:

Expected ';' after expression

The rest of the method then fails throwing this error several times:

Use of undeclared identifier 'weakself'

@tonyarnold tonyarnold was assigned Jan 11, 2013

For now, you may need to use one of the other compiler dialects that does support typeof(). GNU99 is currently Xcode's default (choosing 'Compiler Default' is equivalent to this, I believe).


Great, that solved it, thank you.


Great to hear, @prisonerjohn — thanks for letting me know it all worked out.

@tonyarnold tonyarnold closed this Jan 14, 2013

I've seen the following idiom elsewhere that also works well:

__weak __typeof(&*self) weakself = self;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment