Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -1679,7 +1679,7 @@ Current.setType(TT_LambdaArrow); } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && Current.NestingLevel == 0 && - !Current.Previous->is(tok::kw_operator)) { + !Current.Previous->isOneOf(tok::kw_operator, tok::identifier)) { // not auto operator->() -> xxx; Current.setType(TT_TrailingReturnArrow); } else if (Current.is(tok::arrow) && Current.Previous && Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -6780,6 +6780,9 @@ // Not trailing return types. verifyFormat("void f() { auto a = b->c(); }"); + verifyFormat("auto a = p->foo();"); + verifyFormat("int a = p->foo();"); + verifyFormat("auto lmbd = [] NOEXCEPT -> int { return 0; };"); } TEST_F(FormatTest, DeductionGuides) {