diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h index 9c4ae11d9..92c47a327 100644 --- a/include/flatbuffers/base.h +++ b/include/flatbuffers/base.h @@ -242,7 +242,7 @@ namespace flatbuffers { // Suppress Undefined Behavior Sanitizer (recoverable only). Usage: // - __supress_ubsan__("undefined") // - __supress_ubsan__("signed-integer-overflow") -#if defined(__clang__) +#if defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7)) #define __supress_ubsan__(type) __attribute__((no_sanitize(type))) #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409) #define __supress_ubsan__(type) __attribute__((no_sanitize_undefined))