Closed
Description
This source file:
template <class T, class P>
struct Pointer {
P pointer_ = P();
auto operator*() const -> auto& requires (not std::is_array_v<T>) { return *pointer_; }
auto operator->() const -> auto* requires (not std::is_array_v<T>) { return std::to_address(pointer_); }
};
with this .clang-format:
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: Consecutive
AlignEscapedNewlines: Right
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortCaseLabelsOnASingleLine: true
AllowShortLambdasOnASingleLine: All
AlwaysBreakTemplateDeclarations: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
BeforeElse: true
BeforeCatch: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
BreakConstructorInitializers: BeforeComma
BreakBeforeConceptDeclarations: true
BreakInheritanceList: BeforeComma
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
IndentWidth: 4
IndentWrappedFunctionNames: false
IndentRequires: true
InsertBraces: true
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
PackConstructorInitializers: NextLine
PenaltyBreakAssignment: 20
PenaltyBreakBeforeFirstCallParameter: 175
ContinuationIndentWidth: 4
RequiresClausePosition: OwnLine
PointerAlignment: Left
QualifierAlignment: Custom
QualifierOrder: ['static', 'inline', 'constexpr', 'type', 'const', 'volatile']
Standard: c++20
SpacesInAngles: Never
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterRequiresInClause: true
AfterRequiresInExpression: true
SpacesBeforeTrailingComments: 2
IndentPPDirectives: AfterHash
PPIndentWidth: 2
ColumnLimit: 100
formats as
template <class T, class P>
struct Pointer {
P pointer_ = P();
auto operator*() const -> auto&
requires (not std::is_array_v<T>)
{
return *pointer_;
}
auto operator->() const
-> auto* requires (not std::is_array_v<T>) { return std::to_address(pointer_); }
};
I would expect the operator->()
to be formatted the same way as the operator*()
immediately before it. Here, it's not even respecting the RequiresClausePosition: OwnLine
parameter.