Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -3337,9 +3337,11 @@ } // trailing return type 'auto': []() -> auto {}, auto foo() -> auto {} - if (Left.is(tok::kw_auto) && - Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace)) + if (Left.is(tok::kw_auto) && Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace, + // function return type 'auto' + TT_FunctionTypeLParen)) { return true; + } // auto{x} auto(x) if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace)) Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -24887,7 +24887,7 @@ // the user's own fault verifyFormat("integral auto(x) = y;"); // actually a declaration, but this is // clearly the user's own fault - verifyFormat("auto(*p)() = f;"); // actually a declaration; TODO FIXME + verifyFormat("auto (*p)() = f;"); } TEST_F(FormatTest, Cpp20ModulesSupport) {