Issue 136266
Summary [clang-format] AllowShortCompoundRequirementOnASingleLine conflicts with BraceWrapping
Labels clang-format
Assignees
Reporter tuero
    I'm not sure if this is an issue or expected behaviour. I have a minimal config file, with `AllowShortCompoundRequirementOnASingleLine: true` and with the `BraceWrapping` sub-option `AfterControlStatement: MultiLine`:
```
Language: Cpp
AccessModifierOffset: -4
AllowShortCompoundRequirementOnASingleLine: true # clang-format 18
BraceWrapping: # Requires BreakBeforeBraces: Custom
 AfterControlStatement: MultiLine  # comment me out
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: Always
IndentRequiresClause: true
IndentWidth: 4
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope # clang-format 16
Standard: c++20
TabWidth: 4
UseTab: Never
```

This formats the following concept as such:
```cpp
template <typename T>
concept IsDataset = requires(const T ct) {
    {
        ct.size()
    } -> std::same_as<int>;
};
```

However, if I remove `AfterControlStatement: MultiLine`, then I get what I would expect should be the correct formatting:
```cpp
template <typename T>
concept IsDataset = requires(const T ct) {
    { ct.size() } -> std::same_as<int>;
};
```
**Question**: Is there a way to have both multi-line brace wrapping after control statements, along with single line short compound requirement clauses?

```shell
$ clang-format --version 
Ubuntu clang-format version 20.1.2 (++20250402124932+58df0ef89dd6-1~exp1~20250402004952.98)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to