https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67843
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Created attachment 36458 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36458&action=edit Require consistent shared_ptr lock policy Maybe we should solve this by forcing a linker error when an object doesn't have the same lock policy as the library. This patch causes the shared_ptr tests to FAIL when run with -march=i386, with this error: include/bits/shared_ptr_base.h:160: undefined reference to `void std::__check_lock_policy<(__gnu_cxx::_Lock_policy)1>() Instead of corrupting the heap at run-time the tests fail to link because the library only has a definition for std::__check_lock_policy<(__gnu_cxx::_Lock_policy)2>() The same thing should work for arm and other targets where the availability of atomics depends on -march.