Issue 178145
Summary [bug][clang-format][21.1.8] Cannot correctly format rvalue-ref declarator && in requires clause.
Labels clang-format
Assignees
Reporter yaoxinliu
    ```
template<typename T>
requires std::is_lvalue_reference_v<T&&> and (std::is_rvalue_reference_v<T &&>)
void f2() {
}
```

`std::is_lvalue_reference_v<T&&>` is ok; however, `(std::is_rvalue_reference_v<T &&>)` is not ok, a unexpected space inserted into `T` and `&&`.

my .clang-format file:

```
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
 Enabled: true
    AcrossComments: false
    AlignCompound: true
 AcrossEmptyLines: false
    PadOperators : true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations:    
    Enabled: true
 AlignFunctionDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortCaseExpressionOnASingleLine: true
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AllowShortNamespacesOnASingleLine: true 
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BreakAdjacentStringLiterals: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: Always
BreakBeforeTernaryOperators: true
BreakBinaryOperations: Never
BraceWrapping:
    AfterCaseLabel: false
    AfterClass: false
 AfterControlStatement: false
    AfterEnum: false
    AfterFunction: false
    AfterNamespace: false
    AfterUnion: false
 AfterExternBlock: false
    BeforeCatch: false
    BeforeElse: false
 BeforeLambdaBody: false
    IndentBraces: false
    SplitEmptyFunction: false
    SplitEmptyRecord: false
    SplitEmptyNamespace: false
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: AfterColon
BreakFunctionDefinitionParameters: false 
BreakInheritanceList: BeforeComma
BreakStringLiterals: false
BreakTemplateDeclarations: Yes
ColumnLimit: 120
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
FixNamespaceComments: true
ForEachMacros: ['LOOP', 'TEST_CASE', 'TEST_CASE_GENERATOR']
TypenameMacros: ['LIST_ENTRY']
IncludeBlocks: Preserve
IndentAccessModifiers: false
IndentCaseLabels: false
IndentExportBlock: true
IndentExternBlock: NoIndent
IndentGotoLabels: true
IndentPPDirectives: BeforeHash
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertNewlineAtEOF: true
InsertTrailingCommas: None
KeepEmptyLines:
  AtEndOfFile: false
 AtStartOfBlock: false
  AtStartOfFile: false
KeepEmptyLinesAtTheStartOfBlocks: false
LineEnding: LF
MacroBlockBegin: "^BEGIN_OF_EXAMPLE1|BEGIN_OF_EXAMPLE2$"
MacroBlockEnd: "^END_OF_EXAMPLE$"
MainIncludeChar: Any 
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PointerAlignment: Left
PointerBindsToType: true
PackConstructorInitializers: BinPack
ReflowComments: false
RemoveEmptyLinesInUnwrappedLines: true
SeparateDefinitionBlocks: Always
SkipMacroDefinitionBody: false 
SortIncludes: true
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
    AfterControlStatements: true
 AfterFunctionDeclarationName: false
    AfterPlacementOperator: true
 AfterRequiresInClause: true
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false 
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInLineCommentPrefix:
    Minimum: 1
    Maximum: 1
SpacesInParens: Custom
SpacesInParensOptions:
  ExceptDoubleParentheses: false
  InConditionalStatements: false
  Other: false 
SpacesInSquareBrackets: false
Standard: Latest
StatementMacros: []
TabWidth: 4
UseTab: Never
WrapNamespaceBodyWithEmptyLines: Always

---
Language: Cpp

---
Language: Proto
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to