| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…heck
A C++20 templated lambda like []<typename T>(T&& t) { ... }; was falsely
flagged with readability/braces 'You don't need a ; after a }'. The lambda
exemption relied on the text before '(' ending in ']' (the capture), but a
template parameter list sits between ']' and '(' so the prefix ends in '>'
and the exemption missed it. Also recognize the ]<...> introducer.
Fixes cpplint#385
for more information, see https://pre-commit.ci
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 2959966e-c9b3-4000-a24b-a3c63ccc50d6 📥 CommitsReviewing files that changed from the base of the PR and between bb2f8a6 and c6a64d4. 📒 Files selected for processing (3)
📝 Walkthrough WalkthroughThe trailing-semicolon check now suppresses false warnings for C++20 templated lambdas. Regression tests cover single-line and multi-line lambdas and retain warnings for ordinary templated functions. The changelog documents the fix. ChangesTemplated Lambda Semicolon Handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: aaronliu0130, janmarsino98 🚥 Pre-merge checks | ✅ 5 ✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
There was a problem hiding this comment.
Reviewed at c6a64d4 against current develop.
The same-line / simple multi-line-body cases are fixed, including the exact #385 example, and a templated function still warns. Full suite: 206 passed.
The \\s*<.*>\\s*$ check only looks at the text before ( on that line, so these valid forms still emit readability/braces here (clean on #454):
auto identity = []<
typename T
>(T&& t) { return t; };
auto identity = []
<typename T>
(T&& t) { return t; };
auto identity = []<typename T>
(T&& t) { return t; };
auto identity = []<typename T>
requires std::integral<T>
(T&& t) { return t; };Each compiles under g++ -std=c++20 -pedantic-errors -fsyntax-only. Given the overlap/conflict with #454, I’d lean toward closing this in favor of that PR unless you extend coverage to the multiline/requires cases.
Sorry, something went wrong.
There was a problem hiding this comment.
I independently rechecked c6a64d4 and confirmed that the multiline template and requires-clause cases already reported in the existing review still emit readability/braces on this head, while #454 handles the same inputs and preserves diagnostics for multiline operator[] declarations and constrained functions. Since the two PRs overlap and conflict, I don't think this narrower implementation should merge as-is. Unless this branch is broadened beyond #454, I recommend closing it in favor of #454.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #385.
Problem: a C++20 templated lambda like []<typename T>(T&& t) { ... }; was falsely flagged readability/braces — "You don't need a ; after a }."
Cause: CheckTrailingSemicolon exempts lambdas by checking that the text before ( ends in ] (the capture). A templated lambda puts <T> between ] and (, so the prefix ends in > and the exemption missed it.
Fix: also recognise the ]<...> lambda introducer.
Testing:
Summary by CodeRabbit
Bug Fixes
Tests
Documentation