diff --git a/src/common/conf_post.h b/src/common/conf_post.h index eac832c0..7093ead2 100644 --- a/src/common/conf_post.h +++ b/src/common/conf_post.h @@ -67,7 +67,14 @@ typedef int ssize_t; # define PRETEND_USE(expr) ((void)(expr)) #endif /* PRETEND_USE */ -#ifdef __GNUC__ +// It's complicated to really detect gnu gcc because other compilers define __GNUC__ +// See stackoverflow questions/38499462/how-to-tell-clang-to-stop-pretending-to-be-other-compilers +#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) +#define REAL_GCC __GNUC__ // probably +#endif + +#ifdef REAL_GCC +// Older gcc versions pretended to supply std::regex, but the resulting programs mostly crashed. #include #if ! __GNUC_PREREQ(6,0) #define NO_STD_REGEX 1