diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -460,13 +460,19 @@ "SOURCES;COMPILE_DEPS;DEPS;CFLAGS;LINK_FLAGS" ${ARGN}) foreach(source ${TEST_SOURCES}) - sanitizer_test_compile( - "${test_objects}" "${source}" "${arch}" - KIND ${TEST_KIND} - COMPILE_DEPS ${TEST_COMPILE_DEPS} - DEPS ${TEST_DEPS} - CFLAGS ${TEST_CFLAGS} + if (${source} STREQUAL "sanitizer_allocator_test.cpp" AND APPLE) + # c++17 requires upping min version to 10.13. rdar://98737270 + # Keep 14 standard in allocator test to maintain current back compatibility. + set(STD_CXX "-std=c++14") + endif() + sanitizer_test_compile( + "${test_objects}" "${source}" "${arch}" + KIND ${TEST_KIND} + COMPILE_DEPS ${TEST_COMPILE_DEPS} + DEPS ${TEST_DEPS} + CFLAGS ${TEST_CFLAGS} ${STD_CXX} ) + unset(STD_CXX) endforeach() set(TEST_DEPS ${${test_objects}})