Skip to content

Conversation

@firewave
Copy link
Collaborator

@firewave firewave commented Dec 8, 2025

No description provided.

@firewave

This comment was marked as resolved.

@firewave firewave force-pushed the cxx20 branch 2 times, most recently from 774d19d to 7a010b5 Compare December 29, 2025 19:16
@firewave firewave changed the title pathmatch.cpp: fixed -Wdeprecated-this-capture Clang C++20 warning fixed C++20 build Dec 29, 2025
@firewave firewave changed the title fixed C++20 build fixed #14347 - fixed Clang warnings in C++20 build Dec 29, 2025
@firewave
Copy link
Collaborator Author

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.

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
```
@firewave
Copy link
Collaborator Author

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.

not true - macOS obviously uses Clang...

@sonarqubecloud
Copy link

@firewave
Copy link
Collaborator Author

The C++20 builds fails for macOS:

/Users/runner/work/cppcheck/cppcheck/cmake.output/gui/test/projectfile/moc_testprojectfile.cpp:84:1: error: 'constinit' specifier is incompatible with C++ standards before C++20 [-Werror,-Wc++20-compat]
   84 | Q_CONSTINIT const QMetaObject TestProjectFile::staticMetaObject = { {
      | ^
/opt/homebrew/opt/qt/lib/QtCore.framework/Headers/qcompilerdetection.h:1409:23: note: expanded from macro 'Q_CONSTINIT'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant