diff --git a/llvm/include/llvm/ADT/iterator_range.h b/llvm/include/llvm/ADT/iterator_range.h index 6c66def0fcd77..8e9b22f2d4dfa 100644 --- a/llvm/include/llvm/ADT/iterator_range.h +++ b/llvm/include/llvm/ADT/iterator_range.h @@ -43,7 +43,8 @@ class iterator_range { IteratorT begin_iterator, end_iterator; public: -#if __GNUC__ == 7 || (__GNUC__ == 8 && __GNUC_MINOR__ < 4) +#if defined(__GNUC__) && \ + (__GNUC__ == 7 || (__GNUC__ == 8 && __GNUC_MINOR__ < 4)) // Be careful no to break gcc-7 and gcc-8 < 8.4 on the mlir target. // See https://github.com/llvm/llvm-project/issues/63843 template