-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fixed #14347 - fixed Clang warnings in C++20 build #8021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
774d19d to
7a010b5
Compare
-Wdeprecated-this-capture Clang C++20 warning|
The CI jobs will not trigger the warnings which have been fixed by this. A Clang build is implicitly performed by the clang-tidy job. We could switch that job to a higher standard (C++23 even) and adjust the configuration accordingly. This would also allow us to introduce some more conditional modernizations. |
2260091 to
c107e0e
Compare
not true - macOS obviously uses Clang... |
|
The C++20 builds fails for macOS: |
9fb3f5d to
a7306be
Compare
gui/resultstree.cpp
Outdated
| auto *action = new QAction(tr("No tag"), tagMenu); | ||
| tagMenu->addAction(action); | ||
| connect(action, &QAction::triggered, [=]() { | ||
| connect(action, &QAction::triggered, [EXPLICIT_THIS]() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't this be rewritten so it's compatible both with c++20 and c++14 ? [this] ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works. Thanks.
gui/resultstree.cpp
Outdated
| auto *action = new QAction(tagstr, tagMenu); | ||
| tagMenu->addAction(action); | ||
| connect(action, &QAction::triggered, [=]() { | ||
| connect(action, &QAction::triggered, [EXPLICIT_THIS]() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would [tagstr, this] work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works. Thanks.
example:
```
/home/user/CLionProjects/cppcheck/lib/pathmatch.cpp:37:37: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]
37 | return match(pattern, path, mBasepath, mode, mSyntax);
| ^
/home/user/CLionProjects/cppcheck/lib/pathmatch.cpp:36:63: note: add an explicit capture of 'this' to capture '*this' by reference
36 | return std::any_of(mPatterns.cbegin(), mPatterns.cend(), [=] (const std::string &pattern) {
| ^
| , this
```
Co-authored-by: Daniel Marjamäki <daniel.marjamaki@gmail.com>
|



No description provided.