diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -11515,6 +11515,17 @@ " };\n" "};"); verifyFormat("#define A {a, a},"); + // Don't confuse braced list initializers with compound statements. + verifyFormat( + "class A {\n" + " A() : a{} {}\n" + " A(int b) : b(b) {}\n" + " A(int a, int b) : a(a), bs{{bs...}} { f(); }\n" + " int a, b;\n" + " explicit Expr(const Scalar &x) : u{Constant{x}} {}\n" + " explicit Expr(Scalar &&x) : u{Constant{std::move(x)}} " + "{}\n" + "};"); // Avoid breaking between equal sign and opening brace FormatStyle AvoidBreakingFirstArgument = getLLVMStyle();