[llvm-branch-commits] [clang-tools-extra] release/23.x: [clang-tidy] Fix false positive in readability-trailing-comma (PR #236390)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Nov 1 04:21:08 PST 2026


vadikmironov wrote:

> So to summarize, the warning is incorrect and can be safely ignored, but if one were to run --fix, it would cause code that previously compiled to no longer compile. Would that be a correct assessment?
> 
> How common is this false positive warning? Is this something that could be hit easily/often?
> 
> @vbvictor and @zeyi2 what do you think about porting this change to `release/23.x`?

Yes, as long as there is no `WarningsAsErrors` or `readability-*` glob which enables the check. How often depends on the code style. As far as I can tell, it happens to an aggregate with default member initializers, written as an empty `{}` before another element: an argument `f(S{}, 1)`, or a default argument `S opts = {}, int x = 0`.

I could only find two reports (#220222, and #223646) on 23.1.1 and my project hit it too. When checking LLVM own code, it's not too often this pattern is used. Scanning clang-tidy sources this is reported just in two places, both in `clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h` (`TrackingOptions Opts = {},`).

https://github.com/llvm/llvm-project/pull/236390


More information about the llvm-branch-commits mailing list