Clang-format broken alignment

Viewed 30

I have a problem with clang-format.

Output:

            pending_branches.push_back(tree_node{
                 .curve_params{.inertia        = node.curve_params.inertia,
                               .path_length    = node.curve_params.path_length,
                               .v_0            = seed.v_0 / 2.0f,
                               .r_0            = seed.r_0,
                               .scaling_factor = 0.125f * node.curve_params.scaling_factor},
                 .related_nodes{                  .parent          = parent,
                            .younger_sibling = younger_sibling,
                            .older_sibling   = older_sibling },
                 .level = node.level + 1
         });

To editors: Do not change the indentation in the example above.

Somehow, the first field of related_nodes is not aligned properly. The expected output would be

            pending_branches.push_back(tree_node{
                 .curve_params{.inertia        = node.curve_params.inertia,
                               .path_length    = node.curve_params.path_length,
                               .v_0            = seed.v_0 / 2.0f,
                               .r_0            = seed.r_0,
                               .scaling_factor = 0.125f * node.curve_params.scaling_factor},
                 .related_nodes{.parent          = parent,
                                .younger_sibling = younger_sibling,
                                .older_sibling   = older_sibling},
                 .level = node.level + 1
         });
---
Language: Cpp
BasedOnStyle: Microsoft
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Right
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: Right
AlignOperands: AlignAfterOperator
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Always
AllowShortFunctionsOnASingleLine: All
AllowShortCaseLabelsOnASingleLine: true
AllowShortLambdasOnASingleLine: None
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: After
BreakBeforeBraces: Custom
BraceWrapping:
  AfterCaseLabel:  true
  AfterClass:      true
  AfterControlStatement: Always
  AfterEnum:       true
  AfterFunction:   true
  AfterNamespace:  true
  AfterStruct:     true
  AfterUnion:      true
  AfterExternBlock: true
  BeforeCatch:      true
  BeforeElse:       true
  BeforeLambdaBody: true
  BeforeWhile:     true
  IndentBraces:    false
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  SplitEmptyNamespace: false
BreakBeforeBinaryOperators: All
BreakBeforeConceptDeclarations: true
BreakBeforeTernaryOperators: false
BreakBeforeInheritanceComma: true
BreakInheritanceList: BeforeColon
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: false
ColumnLimit:     100
QualifierAlignment: Right
CompactNamespaces: false
ConstructorInitializerIndentWidth: 5
ContinuationIndentWidth: 5
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
PackConstructorInitializers: CurrentLine
#BasedOnStyle:    ''
AllowAllConstructorInitializersOnNextLine: true
IncludeCategories:
  - Regex:           '<[[:alnum:]_]+>'
    Priority:        3
    CaseSensitive:   false
  - Regex:           <[[:alnum:].
    Priority:        2
    CaseSensitive:   false
  - Regex:           '".'
    Priority:        1
    CaseSensitive:   false
IncludeBlocks: Regroup
IncludeIsMainRegex: '(\.test)?$'
IndentAccessModifiers: false
IndentWidth:     3
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: false
IndentPPDirectives: BeforeHash
IndentExternBlock: AfterExternBlock
IndentRequires:  false
NamespaceIndentation: Inner
IndentWrappedFunctionNames: false
LambdaBodyIndentation: Signature
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
PointerAlignment: Left
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments:  true
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 1
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeParens: Never
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles:  Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
  Minimum:         1
  Maximum:         -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard:        Latest
TabWidth:        3
UseCRLF:         false
UseTab:          ForIndentation

The version of clang-format: Ubuntu clang-format version 14.0.0-1ubuntu1

Is this a bug in clang-format-14 or should I change the clang-format file somehow? It looks like it aligns things properly if I use ( instead of ). However, in this case, this is not legal:

either all initializer clauses should be designated or none of them should be
  599 |                              .related_nodes(.parent          = parent,
0 Answers
Related