You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Including fmtlib's format.h header from an Objective-C++ source file that has itself previously included any Objective-C foundation header (such as Foundation.h) will generate a compilation error (error: expected unqualified-id) in format.h due a conflict between fmtlib's check function and a check macro defined in Apple's AssertMacros.h file.
This was observed in Xcode 7.3.1 (7D1014).
One solution might be to rename the check function so that it doesn't conflict (for example, check_that); this is straightforward, but works (in theory) everywhere... provided the alternative name doesn't conflict with some other obscure macro.
Another option is to use #pragma push_macro to undefine the macro at the start of format.h and pop it back into existence at the end of the file. This approach relies on compiler-specific pragmas which work in GCC, LLVM and Visual Studio but may not be available on other compilers that fmtlib desires to support.
There is also the option, of course, to do nothing; the #pragma workaround can always be implemented by users if they really need it. However it might be useful to at least modify the documentation to note that this is an issue with Objective-C++ code.
I'd be happy to provide a PR for either approach, I'd just like some guidance on whether or not this is an issue considered worth fixing and what direction would be preferable.
The text was updated successfully, but these errors were encountered:
Including fmtlib's
format.h
header from an Objective-C++ source file that has itself previously included any Objective-C foundation header (such asFoundation.h
) will generate a compilation error (error: expected unqualified-id
) informat.h
due a conflict between fmtlib'scheck
function and acheck
macro defined in Apple'sAssertMacros.h
file.This was observed in Xcode 7.3.1 (7D1014).
One solution might be to rename the check function so that it doesn't conflict (for example,
check_that
); this is straightforward, but works (in theory) everywhere... provided the alternative name doesn't conflict with some other obscure macro.Another option is to use
#pragma push_macro
to undefine the macro at the start offormat.h
and pop it back into existence at the end of the file. This approach relies on compiler-specific pragmas which work in GCC, LLVM and Visual Studio but may not be available on other compilers that fmtlib desires to support.There is also the option, of course, to do nothing; the
#pragma
workaround can always be implemented by users if they really need it. However it might be useful to at least modify the documentation to note that this is an issue with Objective-C++ code.I'd be happy to provide a PR for either approach, I'd just like some guidance on whether or not this is an issue considered worth fixing and what direction would be preferable.
The text was updated successfully, but these errors were encountered: