Index: clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp +++ clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp @@ -24,7 +24,8 @@ Finder->addMatcher( binaryOperator(anyOf(hasOperatorName("+"), hasOperatorName("-"), hasOperatorName("+="), hasOperatorName("-=")), - hasType(pointerType())) + hasType(pointerType()), + unless(hasLHS(ignoringImpCasts(declRefExpr(to(isImplicit())))))) .bind("expr"), this); Index: test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp =================================================================== --- test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp +++ test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp @@ -84,4 +84,6 @@ i = j - 1; auto diff = p - q; // OK, result is arithmetic + + for(int ii : a) ; // OK, pointer arithmetic generated by compiler }