Skip to content

fixed #14347 - fixed Clang warnings in C++20 build - #8021

Merged
firewave merged 3 commits into
cppcheck-opensource:mainfrom
firewave:cxx20
Jan 14, 2026
Merged

fixed #14347 - fixed Clang warnings in C++20 build#8021
firewave merged 3 commits into
cppcheck-opensource:mainfrom
firewave:cxx20

Conversation

@firewave

Copy link
Copy Markdown
Collaborator

No description provided.

@firewave

This comment was marked as resolved.

@firewave
firewaveforce-pushed the cxx20 branch 2 times, most recently from 774d19d to 7a010b5CompareDecember 29, 2025 19:16
@firewavefirewave changed the title pathmatch.cpp: fixed -Wdeprecated-this-capture Clang C++20 warningfixed C++20 buildDec 29, 2025
@firewavefirewave changed the title fixed C++20 buildfixed #14347 - fixed Clang warnings in C++20 buildDec 29, 2025
@firewave

Copy link
Copy Markdown
CollaboratorAuthor

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.

@firewave
firewaveforce-pushed the cxx20 branch 3 times, most recently from 2260091 to c107e0eCompareDecember 29, 2025 22:33
@firewave

Copy link
Copy Markdown
CollaboratorAuthor

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...

@firewave

Copy link
Copy Markdown
CollaboratorAuthor

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'

@firewave
firewaveforce-pushed the cxx20 branch 2 times, most recently from 9fb3f5d to a7306beCompareJanuary 12, 2026 01:40
@firewave
firewave marked this pull request as ready for review January 12, 2026 01:40
Comment threadgui/resultstree.cpp Outdated
Comment threadgui/resultstree.cpp Outdated
firewaveand others added 3 commits January 14, 2026 02:45
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>
@sonarqubecloud

Copy link
Copy Markdown

matrix:
os: [windows-2022, windows-2025]
cxxstd: [14, 17]
cxxstd: [14, 17, 20]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to continue adding more c++ versions here.. I like that we are compliant..

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++23 is currently blocked by a long-standing Clang bug: https://trac.cppcheck.net/ticket/14353.

@firewave
firewave merged commit 7abb484 into cppcheck-opensource:mainJan 14, 2026
66 checks passed
@firewave
firewave deleted the cxx20 branch January 14, 2026 14:52
Sign up for freeto 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.

2 participants

@firewave@danmar