diff options
| -rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 3 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index d0a8cfbe69f..2331305cc53 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -351,7 +351,8 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) { NextTok->isOneOf(tok::comma, tok::period, tok::colon, tok::r_paren, tok::r_square, tok::l_brace, tok::l_paren, tok::ellipsis) || - (NextTok->is(tok::semi) && !ExpectClassBody) || + (NextTok->is(tok::semi) && + (!ExpectClassBody || LBraceStack.size() != 1)) || (NextTok->isBinaryOperator() && !NextIsObjCMethod); } if (ProbablyBracedList) { diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 00c23b5bcc1..0bb1bc151a0 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -6192,6 +6192,9 @@ TEST_F(FormatTest, LayoutCxx11BraceInitializers) { " aaaa,\n" " },\n" "};"); + verifyFormat("class C : public D {\n" + " SomeClass SC{2};\n" + "};"); // In combination with BinPackParameters = false. FormatStyle NoBinPacking = getLLVMStyle(); |

