Skip to content

Commit

Permalink
QSharedMemory: fix -Werror=deprecated in C++20 build
Browse files Browse the repository at this point in the history
Capture of *this by reference in [=] is deprecated in C++20. Use the
perfectly adequate [&] instead.

Amends 0740ab5.

Change-Id: I3035a29baf63c22a32aafdcbd4425a3f7b45472f
Reviewed-by: Giuseppe D'Angelo <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
marcmutz committed Jan 25, 2023
1 parent ef1059b commit 26bb750
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/corelib/ipc/qsharedmemory_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,23 @@ class Q_AUTOTEST_EXPORT QSharedMemoryPrivate : public QObjectPrivate

bool handle()
{
return visit([=](auto p) { return !!p->handle(this); });
return visit([&](auto p) { return !!p->handle(this); });
}
bool cleanHandle()
{
return visit([=](auto p) { return p->cleanHandle(this); });
return visit([&](auto p) { return p->cleanHandle(this); });
}
bool create(qsizetype size)
{
return visit([=](auto p) { return p->create(this, size); });
return visit([&](auto p) { return p->create(this, size); });
}
bool attach(QSharedMemory::AccessMode mode)
{
return visit([=](auto p) { return p->attach(this, mode); });
return visit([&](auto p) { return p->attach(this, mode); });
}
bool detach()
{
return visit([=](auto p) { return p->detach(this); });
return visit([&](auto p) { return p->detach(this); });
}

inline void setError(QSharedMemory::SharedMemoryError e, const QString &message)
Expand Down

0 comments on commit 26bb750

Please sign in to comment.