Skip to content
Snippets Groups Projects
Verified Commit a05402c4 authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

add explicit capture for `this`

This addresses the following warnings from GCC 9:

    dune/common/test/testsuite.hh:78:30: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
    dune/common/test/testsuite.hh:99:30: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]

Note that pre-C++20 does not allow to explicitly capture `this` when
the default capture is `=`.  So all captures need to be listed.
parent 59d1a167
Branches
Tags
1 merge request!684add explicit capture for `this`
......@@ -75,7 +75,7 @@ namespace Dune {
if (not condition)
++failedChecks_;
return CollectorStream([=](std::string reason) {
return CollectorStream([condition, name, this](std::string reason) {
if (not condition)
this->announceCheckResult(throwPolicy_, "CHECK ", name, reason);
});
......@@ -96,7 +96,7 @@ namespace Dune {
if (not condition)
++failedChecks_;
return CollectorStream([=](std::string reason) {
return CollectorStream([condition, name, this](std::string reason) {
if (not condition)
this->announceCheckResult(true, "REQUIRED CHECK", name, reason);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment