Skip to content

Commit 7abb484

Browse files
firewavedanmar
andauthored
fixed #14347 - fixed Clang warnings in C++20 build (danmar#8021)
Co-authored-by: Daniel Marjamäki <daniel.marjamaki@gmail.com>
1 parent fff4f52 commit 7abb484

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

.github/workflows/CI-unixish.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,16 @@ jobs:
196196
strategy:
197197
matrix:
198198
os: [ubuntu-22.04, macos-15]
199-
cxxstd: [14, 17]
199+
cxxstd: [14, 17, 20]
200+
# FIXME: macos-15 fails to compile with C++20
201+
#
202+
# /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]
203+
# 84 | Q_CONSTINIT const QMetaObject TestProjectFile::staticMetaObject = { {
204+
# | ^
205+
# /opt/homebrew/opt/qt/lib/QtCore.framework/Headers/qcompilerdetection.h:1409:23: note: expanded from macro 'Q_CONSTINIT'
206+
exclude:
207+
- os: macos-15
208+
cxxstd: 20
200209
fail-fast: false # Prefer quick result
201210

202211
runs-on: ${{ matrix.os }}

.github/workflows/CI-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
strategy:
7676
matrix:
7777
os: [windows-2022, windows-2025]
78-
cxxstd: [14, 17]
78+
cxxstd: [14, 17, 20]
7979
fail-fast: false
8080

8181
runs-on: ${{ matrix.os }}

gui/resultstree.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,15 +713,15 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
713713
{
714714
auto *action = new QAction(tr("No tag"), tagMenu);
715715
tagMenu->addAction(action);
716-
connect(action, &QAction::triggered, [=]() {
716+
connect(action, &QAction::triggered, [this]() {
717717
tagSelectedItems(QString());
718718
});
719719
}
720720

721721
for (const QString& tagstr : currentProject->getTags()) {
722722
auto *action = new QAction(tagstr, tagMenu);
723723
tagMenu->addAction(action);
724-
connect(action, &QAction::triggered, [=]() {
724+
connect(action, &QAction::triggered, [tagstr, this]() {
725725
tagSelectedItems(tagstr);
726726
});
727727
}

lib/pathmatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ PathMatch::PathMatch(std::vector<std::string> patterns, std::string basepath, Sy
3333

3434
bool PathMatch::match(const std::string &path, Filemode mode) const
3535
{
36-
return std::any_of(mPatterns.cbegin(), mPatterns.cend(), [=] (const std::string &pattern) {
36+
return std::any_of(mPatterns.cbegin(), mPatterns.cend(), [&] (const std::string &pattern) {
3737
return match(pattern, path, mBasepath, mode, mSyntax);
3838
});
3939
}

0 commit comments

Comments
 (0)