Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -521,9 +521,8 @@ Keywords.kw_as)) || (Style.isCpp() && NextTok->is(tok::l_paren)) || NextTok->isOneOf(tok::comma, tok::period, tok::colon, - tok::r_paren, tok::r_square, tok::l_brace, - tok::ellipsis) || - (NextTok->is(tok::identifier) && + tok::r_paren, tok::r_square, tok::ellipsis) || + (NextTok->isOneOf(tok::l_brace, tok::identifier) && !PrevTok->isOneOf(tok::semi, tok::r_brace, tok::l_brace)) || (NextTok->is(tok::semi) && (!ExpectClassBody || LBraceStack.size() != 1)) || Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -11731,6 +11731,19 @@ " f(v);\n" "}"); + verifyFormat("void foo() {\n" + " { // asdf\n" + " {\n" + " int a;\n" + " }\n" + " }\n" + " {\n" + " {\n" + " int b;\n" + " }\n" + " }\n" + "}"); + // Long lists should be formatted in columns even if they are nested. verifyFormat( "vector x = function({1, 22, 333, 4444, 55555, 666666, 7777777,\n"