<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57518>57518</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] wrong formatting of initializer list
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          paolo-mastrapasqua
      </td>
    </tr>
</table>

<pre>
    Input code:
```cpp
    struct TestParams
    {
        std::chrono::nanoseconds notificationPeriod;
        std::chrono::nanoseconds timeout;
    };

    std::vector<TestParams> testParams = {
        {
            std::chrono::nanoseconds{0},        // Don't notify condition variable
            std::chrono::nanoseconds{1'000'000} // 1ms
        },
        {
            std::chrono::nanoseconds{0},         // Don't notify condition variable
            std::chrono::nanoseconds{10'000'000} // 10ms
        },
        {
            std::chrono::nanoseconds{0},          // Don't notify condition variable
            std::chrono::nanoseconds{100'000'000} // 100ms
        },
        {
            std::chrono::nanoseconds{0},            // Don't notify condition variable
            std::chrono::nanoseconds{2'000'000'000} // 2s
        },
    };
```

Output code:
```cpp
    struct TestParams
    {
        std::chrono::nanoseconds notificationPeriod;
        std::chrono::nanoseconds timeout;
    };

    std::vector<TestParams> testParams = {
        {
         std::chrono::nanoseconds{0},     // Don't notify condition variable
     std::chrono::nanoseconds{1'000'000} // 1ms},
        {
         std::chrono::nanoseconds{0},   // Don't notify condition variable
   std::chrono::nanoseconds{10'000'000} // 10ms},
        {
         std::chrono::nanoseconds{0}, // Don't notify condition variable
 std::chrono::nanoseconds{100'000'000} // 100ms},
        {
         std::chrono::nanoseconds{0},  // Don't notify condition variable
  std::chrono::nanoseconds{2'000'000'000} // 2s},
    };
```
As you can see, the internal `},` sequences end up in the comments on the previous lines, making the resulting code illegal.

I'm using version 14.0.6, with the following configuration file:
```
---
Language: Cpp
# BasedOnStyle:  LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Right
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
  AfterCaseLabel: true
  AfterClass: true
  AfterControlStatement: true
  AfterEnum: true
  AfterFunction: true
  AfterNamespace: true
  AfterObjCDeclaration: true
  AfterStruct: true
  AfterUnion: true
  AfterExternBlock: true
  BeforeCatch: true
  BeforeElse: true
  BeforeLambdaBody: true
  BeforeWhile: true
  IndentBraces: false
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeComma
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
  - foreach
  - Q_FOREACH
  - BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
  - Regex: "^<"
    Priority: 1
    SortPriority: 0
  - Regex: '^"(gtest|gmock|fmt|xercesc|boost|CLI|uuid|dds|refl|magic_enum|xtypes)'
    Priority: 2
    SortPriority: 0
  - Regex: '^"hrtf'
    Priority: 3
    SortPriority: 0
  - Regex: ".*"
    Priority: 4
    SortPriority: 0
IncludeIsMainRegex: "(Test)?$"
IncludeIsMainSourceRegex: ""
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReferenceAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Before
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
  - Q_UNUSED
  - QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWFtX4zgS_jXhxQeO4wCBhzwkTrLrnTSBJEyfeeIotuxosCWPJAPZX78lyXc7XHq652k5EGLVp1JVqfRVyXsWHCceTTNp-SzAg9F0YM8H9nRwbZtfP03NiAU_QvLMl9YOC3mPOEpEJRqMZ9WDwQZK22jqHzijzHyniDKBfUYDYVEmSUh8JAmj95gTBviv6pAkwSyTjYmD8bx8rpueq3rBvmR8MHJrXowWliyfrMFo3nWnM_AZ-2CSrcxx3FKNs4Rfa87owBlLE4OjpcBExcF6QZygfYx_aK0h6LRtO_8cz4vVhvWNKkLkuL_EwV_soX3KRfuf9PFXO3nay3_WzV_sqNNws-2s84GnjXNe0FX92K8z-X9e-zqvfTFRfiBD_iaVfSrjv-TFl33421T1s334ogc_gYV--i58dRN-BsF8nlKmwjqyzPIRtQTGymB5wBahEnOKYkvhjLJrGwB_ZZj6WFiYBlaWAkyjfZYkmEphMfOccvxCWCasmFAslM4EPRMaaSHHIoulelIEZpE4xhGKL-rn3wOXEisTCvSCuVBRGl5e2BfXStcrkQetKWRxzF6NJhqSKOOam6yQxD3EaB7Pz8_NlxWiUYYiBbTcgjMHzsiaIYGDNd3Ko9ZiWavV79_yWPngu_jGAuBBzNdhKLBUkPPLXB6TiE5DCN06xXTGkf9sAFpQx3COjutwq-k5g4go0IZEB1kDuYzCjmeSvOBvyOdMg2AG7sdMhYABvQ_vA-fYj5EJlUaGKBZ16EL4KMXBHX412weQFQ7rloF3HKlM7K6z44jAtMjNU6INgQ2DjymPMi1e0zv8JlewTj9Qma2DxLhH4bigmPwXEuKjabowYKmQYc3dd6dtD4zLWcz8Z1A_3YIPMS6gdxjSsI11IVFWaI_jLr4R0gK_zKivg95Vz2gHvULJPkBdrEfVrrTRHuQSk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