Skip to content

Commit

Permalink
Merge pull request #44451 from iarspider/cpp20-no-implicit-this-capture
Browse files Browse the repository at this point in the history
[CPP20] Remove deprecated implicit capture of this
  • Loading branch information
cmsbuild authored Mar 28, 2024
2 parents 8d5b9e0 + 59ad727 commit 215a20c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions FWCore/Framework/interface/EventSetupRecordImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ namespace edm {
std::shared_ptr<ESHandleExceptionFactory>& whyFailedFactory) const {
DataKey const* dataKey = nullptr;
if (iResolverIndex.value() == std::numeric_limits<int>::max()) {
whyFailedFactory = makeESHandleExceptionFactory([=] {
whyFailedFactory = makeESHandleExceptionFactory([this] {
NoProductResolverException<DataT> ex(this->key(), {});
return std::make_exception_ptr(ex);
});
Expand All @@ -178,7 +178,7 @@ namespace edm {
iResolverIndex.value() < static_cast<ESResolverIndex::Value_t>(keysForProxies_.size()));
void const* pValue = this->getFromResolverAfterPrefetch(iResolverIndex, iTransientAccessOnly, oDesc, dataKey);
if (nullptr == pValue) {
whyFailedFactory = makeESHandleExceptionFactory([=] {
whyFailedFactory = makeESHandleExceptionFactory([this, dataKey] {
NoProductResolverException<DataT> ex(this->key(), *dataKey);
return std::make_exception_ptr(ex);
});
Expand Down
5 changes: 4 additions & 1 deletion FWCore/Framework/src/Principal.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/**----------------------------------------------------------------------
----------------------------------------------------------------------*/
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wc++20-extensions"
#endif

#include "FWCore/Framework/interface/Principal.h"

Expand Down Expand Up @@ -581,7 +584,7 @@ namespace edm {

ProductData const* result = findProductByLabel(kindOfType, typeID, inputTag, consumer, sra, mcc);
if (result == nullptr) {
return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
return BasicHandle(makeHandleExceptionFactory([=, this]() -> std::shared_ptr<cms::Exception> {
return makeNotFoundException(
"getByLabel",
kindOfType,
Expand Down
6 changes: 5 additions & 1 deletion FWCore/Framework/test/stubs/ToyIntProducers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Toy EDProducers of Ints for testing purposes only.
----------------------------------------------------------------------*/

#ifdef __clang__
#pragma GCC diagnostic ignored "-Wc++20-extensions"
#endif

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/TestObjects/interface/ToyProducts.h"
Expand Down Expand Up @@ -610,7 +614,7 @@ namespace edmtest {
public:
explicit ManyIntWhenRegisteredProducer(edm::ParameterSet const& p)
: sourceLabel_(p.getParameter<std::string>("src")) {
callWhenNewProductsRegistered([=](edm::BranchDescription const& iBranch) {
callWhenNewProductsRegistered([=, this](edm::BranchDescription const& iBranch) {
if (iBranch.moduleLabel() == sourceLabel_) {
if (iBranch.branchType() != edm::InEvent) {
throw edm::Exception(edm::errors::UnimplementedFeature)
Expand Down
6 changes: 5 additions & 1 deletion FWCore/Modules/src/SwitchProducer.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wc++20-extensions"
#endif

#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
Expand All @@ -24,7 +28,7 @@ namespace edm {
auto const& moduleLabel = iConfig.getParameter<std::string>("@module_label");
auto const& chosenLabel = iConfig.getUntrackedParameter<std::string>("@chosen_case");
auto const& processName = iConfig.getUntrackedParameter<std::string>("@process_name");
callWhenNewProductsRegistered([=](edm::BranchDescription const& iBranch) {
callWhenNewProductsRegistered([=, this](edm::BranchDescription const& iBranch) {
if (iBranch.moduleLabel() == chosenLabel and iBranch.processName() == processName) {
if (iBranch.branchType() != InEvent) {
throw Exception(errors::UnimplementedFeature)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "DataFormats/Common/interface/DeviceProduct.h"
#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
#include "FWCore/Framework/interface/moduleAbilities.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Utilities/interface/EDPutToken.h"
#include "FWCore/Utilities/interface/Transition.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/DeviceProductType.h"
Expand Down
2 changes: 1 addition & 1 deletion RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void PatternRecognitionbyFastJet<TILES>::buildJetAndTracksters(std::vector<Pseud
}

auto trackster_idx = result.size();
auto jetsSize = std::count_if(jets.begin(), jets.end(), [=](fastjet::PseudoJet jet) {
auto jetsSize = std::count_if(jets.begin(), jets.end(), [this](fastjet::PseudoJet jet) {
return jet.constituents().size() > static_cast<unsigned int>(minNumLayerCluster_);
});
result.resize(trackster_idx + jetsSize);
Expand Down

0 comments on commit 215a20c

Please sign in to comment.