Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -2039,7 +2039,7 @@ const FormatToken *Previous = FormatTok->Previous; if (Previous && (Previous->isOneOf(tok::identifier, tok::kw_operator, tok::kw_new, - tok::kw_delete, tok::l_square) || + tok::kw_delete, tok::l_square, tok::star) || FormatTok->isCppStructuredBinding(Style) || Previous->closesScope() || Previous->isSimpleTypeSpecifier())) { nextToken(); Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -3336,6 +3336,14 @@ verifyFormat("if (public == private)\n"); verifyFormat("void foo(public, private)"); verifyFormat("public::foo();"); + + verifyFormat("class A {\n" + "public:\n" + " std::unique_ptr b() { return nullptr; }\n" + "\n" + "private:\n" + " int c;\n" + "};"); } TEST_F(FormatTest, SeparatesLogicalBlocks) {