[clang-format] Option for putting `requires`-clause and `= default;` in one line
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
It seems that clang-format hasn't supported putting trailing `requires`-clause and `= default;` in one line. E.g. the following style isn't properly supported.
```C++
template
struct Foo {
Foo() requires Bar = default; // <- Currently clang-format puts this in more than one lines.
};
```
Such formatting style has been becoming more and more frequent in the C++ working draft/standard since [P2325R3](https://wg21.link/p2325r3). I guess clang-format should support it.
Contributor guide
Research direction
Start by running clang-format on the C++ example in the issue and compare its output with the requested single-line form. Trace the formatting path that handles trailing requires-clauses and defaulted declarations, then add coverage showing the declaration remains on one line when it fits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100