Index: clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp +++ clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp @@ -109,9 +109,13 @@ } removeVoidArgumentTokens(Result, SourceRange(Start, End), "function definition"); - } else + } else if (!Function->getLexicalDeclContext()->isFunctionOrMethod()) { + // Only do this if our decl context is outside of a function or method; + // otherwise, the user may have explicitly written `(void)` to avoid Most + // Vexing Parse warnings. removeVoidArgumentTokens(Result, SourceRange(Start, End), "function declaration"); + } } bool isMacroIdentifier(const IdentifierTable &Idents, const Token &ProtoToken) { Index: clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp +++ clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp @@ -592,3 +592,9 @@ (void)a; } #undef return_t + +// Explicitly specifying `(void)` is a way to sidestep -Wvexing-parse, so we +// should not warn about it here. +void most_vexing_parse() { + int foo(void); +}