I maintain a mixed C and C++ command line program that needs to run on Linux, Windows, and OS X. I recently upgraded to Yosemite and my OS X build is now failing. The error is:
/usr/include/dispatch/object.h:143:15: error: expected identifier or '(' before '^' token
Other folks have run into this bug.
The line of code that fails is a typedef that uses '^' which is a non-standard extension providing support for closures.
The underlying problem seems to be that some Apple standard headers are starting to require Clang specific extensions. Unfortunately our program has a very deep set of dependencies, some of which won't compile under Clang. We've been using the GCC compilers installed via MacPorts. I have a workaround for now: changing the line in the object.h
header to be GCC compatible. However, hacking up the include files under /usr/include
sounds to me like asking for trouble.
Can any OS X/Clang gurus suggest more sustainable ways of coping with this problem? Does this limit the future usefulness of GCC on OS X?