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

    <tr>
        <th>Summary</th>
        <td>
            clang-format-17 fails to format nested initializers when ColumnLimit is set
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          docquantum
      </td>
    </tr>
</table>

<pre>
    # Problem

Nested initializers fail to format correctly when `ColumnLimit` is set.

# Version

This exists in older version of `clang-format` as well. However, the version I am testing with is:
```
Ubuntu clang-format version 17.0.0 (++20230607042350+cb9f1aaddac0-1~exp1~20230607042512.983)
```

# Tests

My test code is as follows:
```cpp
GPIO_Config r_led = {
    .Type    = GPIOA,
    .Init          = {.Pin   = GPIO_PIN_7,
 .Mode  = GPIO_MODE_OUTPUT_PP,
                .Pull  = GPIO_NOPULL,
                   .Speed = GPIO_SPEED_FREQ_LOW,},
 .InitSecond = {.Pin   = GPIO_PIN_7,
                   .Mode  = GPIO_MODE_OUTPUT_PP,
                   .Pull  = GPIO_NOPULL,
 .Speed = GPIO_SPEED_FREQ_LOW,},
};
```

When `ColumnLimit: 80` is set, formatting is ignored for the struct and continues after the semicolon.

However, removing the trailing commas in the nested structs does produce an expected result:
```cpp
GPIO_Config r_led = {
    .Type       = GPIOA,
    .Init       = {.Pin   = GPIO_PIN_7,
                   .Mode  = GPIO_MODE_OUTPUT_PP,
 .Pull  = GPIO_NOPULL,
                   .Speed = GPIO_SPEED_FREQ_LOW},
    .InitSecond = {.Pin   = GPIO_PIN_7,
 .Mode  = GPIO_MODE_OUTPUT_PP,
                   .Pull  = GPIO_NOPULL,
                   .Speed = GPIO_SPEED_FREQ_LOW},
};
```

If I set `ColumnLimit: 0`, formatting works as expected for the block:
```cpp
GPIO_Config r_led = {
    .Type = GPIOA,
    .Init = {
        .Pin   = GPIO_PIN_7,
 .Mode  = GPIO_MODE_OUTPUT_PP,
        .Pull  = GPIO_NOPULL,
 .Speed = GPIO_SPEED_FREQ_LOW,
    },
    .InitSecond = {
 .Pin   = GPIO_PIN_7,
        .Mode  = GPIO_MODE_OUTPUT_PP,
 .Pull  = GPIO_NOPULL,
        .Speed = GPIO_SPEED_FREQ_LOW,
 },
};
```

# Configuration
My `.clang-format`:
```yml
---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments: 
 Enabled: true
  AcrossEmptyLines: false
  AcrossComments: false
 AlignCompound: true
  PadOperators: true
AlignConsecutiveBitFields: 
  Enabled: true
  AcrossEmptyLines: false
  AcrossComments: false
  AlignCompound: false
  PadOperators: false
AlignConsecutiveDeclarations: 
  Enabled: true
 AcrossEmptyLines: false
  AcrossComments: false
  AlignCompound: false
  PadOperators: false
AlignConsecutiveMacros: 
  Enabled: true
  AcrossEmptyLines: false
  AcrossComments: false
 AlignCompound: false
  PadOperators: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: 
  Kind: Always
 OverEmptyLines: 1
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: No
AttributeMacros: 
  - __capability
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: Both
BraceWrapping: 
  AfterCaseLabel: false
  AfterClass: true
  AfterControlStatement: Never
  AfterEnum: false
  AfterExternBlock: false
  AfterFunction: true
 AfterNamespace: true
  AfterObjCDeclaration: false
  AfterStruct: false
  AfterUnion: false
  BeforeCatch: false
  BeforeElse: false
  BeforeLambdaBody: false
  BeforeWhile: false
  IndentBraces: false
  SplitEmptyFunction: false
  SplitEmptyRecord: false
 SplitEmptyNamespace: false
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: All
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Custom
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma: '
CompactNamespaces: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: 
  - foreach
  - Q_FOREACH
  - BOOST_FOREACH
IfMacros: 
  - KJ_IF_MAYBE
IncludeBlocks: Regroup
IncludeCategories: 
  - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
    Priority: 2
    SortPriority: 0
    CaseSensitive: false
  - Regex: '^(<|"(gtest|gmock|isl|json)/)'
    Priority: 3
    SortPriority: 0
    CaseSensitive: false
  - Regex: '.*'
    Priority: 1
 SortPriority: 0
    CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: NoIndent
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertBraces: true
InsertNewlineAtEOF: true
InsertTrailingCommas: None
IntegerLiteralSeparator: 
  Binary: 0
  Decimal: 0
  Hex: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: Never
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Left
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveSemicolon: true
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 0
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix: 
  Minimum: 1
  Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++17
StatementAttributeLikeMacros: 
  - Q_EMIT
StatementMacros: 
  - Q_UNUSED
  - QT_REQUIRE_VERSION
TabWidth: 4
UseTab: Never
WhitespaceSensitiveMacros: 
  - BOOST_PP_STRINGIZE
  - CF_SWIFT_NAME
  - NS_SWIFT_NAME
  - PP_STRINGIZE
  - STRINGIZE
...
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWl9z6jaw_zTOiycMmCQkD3kAAy09BDiYNNP7wgh5MeqRJVeSE7gP_ex3JPm_nZy0PWfmZtoDaH9araTfrnZlIylJxAAenduJczu9Qqk6cfEYcvxXiphK46sDDy-Pjjd0N4IfKMROf-r0x_bfFUgFoUsYUQRR8r8gpHtEhLqKu0cuYqRczIUArOjFfTsBc527vs9pGrMliYly7vouka4E1auq1aP9DkISzqrNuxORLpyJVNIlzOU0BOG-WpzLj1o3pohF13ZorRxJ9w0o7bm_8jd4BeF4vqtOUPRauCh2FUhFWOS-EXVyiXSGuRl3_ew_8_P5kDKVutUhCj2DUa_f67uOd-94E8ebeH1v2L_rj_o33vC273gTfHg4DhAKQ4T714O_4ZwM_q6Abgde7-F-6HgPnUOXy7IDqWS18eli7HcxD0GvJZLukVPK3zrmgZPEtvyyWaz3PmdHErliTyF0neHUdUYTK3Zd1-3tLgnoL1qi8WPH8yviBSPKLf6y7r0NYZUu-81itR-V_XpP2shS_LSezvbr593mebffbGr6q3-9TUpppdtqvXleLt-F6x5BAtmkTI9gM5tN9_Pt7Ot-uX7RPUfTill6LgFgzsJPTqRjxH83tU_M7h_NRX8fTj7g0EuHEw7H7n2_dEXtI5bexiuIdEnEuIBQtxrvkUqkWLmIhS7mTBGWgnTRUUEmhphgTjmrOXXFAwXE_FXr1mglEKH6B-ZxjIxn62ZmQ4sdSrohB-kmgocpBhcxF84JYA0QIFOqfhDXP0X3n02RH073Ktfzufwjuv88cv-XuXyX64uju9CE7uC7gdZ5_sbFNxM-C2rldD9Qjr_9CIZ9xK1WF7t8P3Jf_nukKdR9glMFmz_jJj_YNz47k39EJ3382l1OBVJFbvJ00fzqNTKPNl0uMb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