Index: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp +++ clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp @@ -56,12 +56,14 @@ // 1) just before array subscription // 2) inside a range-for over an array // 3) if it converts a string literal to a pointer + // 4) if it converts a predefined value to a pointer Finder->addMatcher( implicitCastExpr( unless(hasParent(arraySubscriptExpr())), unless(hasParentIgnoringImpCasts(explicitCastExpr())), unless(isInsideOfRangeBeginEndStmt()), - unless(hasSourceExpression(ignoringParens(stringLiteral())))) + unless(hasSourceExpression(ignoringParens(stringLiteral()))), + unless(hasSourceExpression(ignoringParens(predefinedExpr())))) .bind("cast"), this); } Index: test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp =================================================================== --- test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp +++ test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp @@ -44,6 +44,9 @@ return ("clang"); // OK, ParenExpr hides the literal-pointer decay } +const char *line = __FILE__; // OK +const char *func = __FUNCTION__; // OK, predefined value to pointer + void f2(void *const *); void bug25362() { void *a[2];