Project

General

Profile

Actions

Bug #42905

closed

Clang compiler Generates errors on using a reference in a Lambda function

Added by Willem Jan Withagen over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Probably because of the possible introduction of modules in C++20
Which perhaps is not going to make the standard.
Best to keep clear of it.

In file included from /home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:22:
In file included from /home/jenkins/workspace/ceph-master/src/osd/OSDMap.h:37:
In file included from /home/jenkins/workspace/ceph-master/src/osd/osd_types.h:48:
In file included from /home/jenkins/workspace/ceph-master/src/osd/Watch.h:19:
In file included from /home/jenkins/workspace/ceph-master/src/include/Context.h:29:
/home/jenkins/workspace/ceph-master/src/common/error_code.h:28:7: warning: 'ceph::converting_category' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor]
class converting_category : public boost::system::error_category {
^
/home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:483:39: error: 'module' in capture list does not name a variable
finisher.queue(new LambdaContext([module, notify_type, notify_id](int r){
^
/home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:484:7: error: reference to local binding 'module' declared in enclosing function 'ActivePyModules::notify_all'
module->notify(notify_type, notify_id);
^
/home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:479:21: note: 'module' declared here
for (auto& [name, module] : modules) {
^
/home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:502:39: error: 'module' in capture list does not name a variable
finisher.queue(new LambdaContext([module, log_entry](int r){
^
/home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:503:7: error: reference to local binding 'module' declared in enclosing function 'ActivePyModules::notify_all'
module->notify_clog(log_entry);
^
/home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:494:21: note: 'module' declared here
for (auto& [name, module] : modules) {
^
/home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:994:39: error: 'module' in capture list does not name a variable
finisher.queue(new LambdaContext([module](int r){
^
/home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:995:7: error: reference to local binding 'module' declared in enclosing function 'ActivePyModules::config_notify'
module->config_notify();
^
/home/jenkins/workspace/ceph-master/src/mgr/ActivePyModules.cc:990:21: note: 'module' declared here
for (auto& [name, module] : modules) {
^
1 warning and 6 errors generated.

Actions #1

Updated by Willem Jan Withagen over 4 years ago

Willem Jan Withagen wrote:

Probably because of the possible introduction of modules in C++20
Which perhaps is not going to make the standard.
Best to keep clear of it.

Turns out to be:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2313

Actions #2

Updated by Jan Fajerski over 4 years ago

  • Project changed from ceph-volume to devops
Actions #3

Updated by Willem Jan Withagen over 4 years ago

  • Subject changed from Clang compiler dos not like the use of modules as variable name to Clang compiler Generates errors on using a reference in a Lambda function
Actions #4

Updated by Willem Jan Withagen over 4 years ago

  • Pull request ID set to 31786
Actions #5

Updated by Kefu Chai over 4 years ago

  • Project changed from devops to mgr
  • Status changed from New to Fix Under Review
  • Assignee set to Willem Jan Withagen
  • Target version deleted (v15.0.0)
Actions #6

Updated by Kefu Chai over 4 years ago

  • Status changed from Fix Under Review to Resolved
Actions

Also available in: Atom PDF