[clang-tidy] False positive readability-trailing-comma with brace initialization
Open
clang-tidy
false-positive
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Example:
```cpp
void f()
{
int x{123 +
456};
}
```
Leads to:
```
source>:4:14: warning: initializer list should have a trailing comma [readability-trailing-comma]
4 | 456};
| ^
| ,
1 warning generated.
```
[Godbolt.](https://godbolt.org/z/n9T6ovheq)
Contributor guide
Research direction
Start by reproducing the warning from the C++ example and Godbolt link, then trace the clang-tidy readability-trailing-comma check named in the report. Add coverage for brace initialization whose expression spans lines, and verify that this false positive no longer appears while the check still reports genuine missing trailing commas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100