diff --git a/FWCore/Framework/interface/EventSetupRecordImpl.h b/FWCore/Framework/interface/EventSetupRecordImpl.h index 59af3f2fdcb6e..9c62ac9016c93 100644 --- a/FWCore/Framework/interface/EventSetupRecordImpl.h +++ b/FWCore/Framework/interface/EventSetupRecordImpl.h @@ -167,8 +167,8 @@ namespace edm { std::shared_ptr& whyFailedFactory) const { DataKey const* dataKey = nullptr; if (iResolverIndex.value() == std::numeric_limits::max()) { - whyFailedFactory = makeESHandleExceptionFactory([=, *this] { - NoProductResolverException ex(this->key(), {}); + whyFailedFactory = makeESHandleExceptionFactory([=, &key=this->key_] { + NoProductResolverException ex(key, {}); return std::make_exception_ptr(ex); }); iData = nullptr; @@ -178,8 +178,8 @@ namespace edm { iResolverIndex.value() < static_cast(keysForProxies_.size())); void const* pValue = this->getFromResolverAfterPrefetch(iResolverIndex, iTransientAccessOnly, oDesc, dataKey); if (nullptr == pValue) { - whyFailedFactory = makeESHandleExceptionFactory([=, *this] { - NoProductResolverException ex(this->key(), *dataKey); + whyFailedFactory = makeESHandleExceptionFactory([=, &key=this->key_] { + NoProductResolverException ex(key, *dataKey); return std::make_exception_ptr(ex); }); }