https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78267
--- Comment #40 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> --- > --- Comment #37 from Jack Howarth <howarth.at.gcc at gmail dot com> --- > Created attachment 40045 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40045&action=edit > preprocessed source for sanitizer_mac.cc from stage3 > > preprocessed source for sanitizer_mac.cc from stage3 generated with... [...] > error: ‘_Static_assert’ was not declared in this scope > os_trace("Address Sanitizer reported a failure."); > ^~~~~~~~~~~~~~ What a mess: I initially misunderstood this error. The problem is: 10.11 <os/trace.h> unconditionally uses _Static_assert, which is C11 only, while sanitizer_mac.cc is compiled with -std=gnu++11. clang++ supports it as an extension, while g++ does not. One could use #define _Static_assert static_assert for C++11 and up, and #define _Static_assert(x) otherwise. However ... > ../../../../gcc-7-20161114/libsanitizer/sanitizer_common/sanitizer_mac.cc:497:9: > error: ‘_os_trace_with_buffer’ was not declared in this scope > os_trace("Address Sanitizer reported a failure."); > ^~~~~~~~~~~~~~~~~~~~~ this one is ugly: os_trace expands to _os_trace_<N>, which all call _os_trace_with_buffer with a NULL payload. That declaration is disabled if !__BLOCKS__, thus the `was not declared' error ;-( On 10.12, os_trace goes to an OS_TRACE_CALL macro which expands to nothing for anything but clang 7.3 and up... The more I look into this chaos, the more attractive I find your patch to disable <os/trace.h> inclusion if !__BLOCKS__. Seems we cannot do better than achieve the same with much more effort. Rainer