Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bogus warning about a null pointer in a lambda. #13289

Merged
merged 1 commit into from Jan 25, 2022

Conversation

drwells
Copy link
Member

@drwells drwells commented Jan 24, 2022

I get the following warning:

/home/drwells/Documents/Code/CPP/dealii-dev/source/base/mpi.cc: In static member function 
'static constexpr void dealii::Utilities::MPI::create_mpi_data_type_n_bytes(std::size_t)::<lambda(ompi_datatype_t**)>::_FUN(ompi_datatype_t**)':
/home/drwells/Documents/Code/CPP/dealii-dev/source/base/mpi.cc:384:15: warning: 'this' pointer is null [-Wnonnull]
  384 |               }};
      |               ^
/home/drwells/Documents/Code/CPP/dealii-dev/source/base/mpi.cc:376:15: 
note: in a call to non-static member function 
'dealii::Utilities::MPI::create_mpi_data_type_n_bytes(std::size_t)::<lambda(ompi_datatype_t**)>'
  376 |               [](MPI_Datatype *p) {
      |               ^

This isn't a problem since deleters don't store any kind of state but we can work around it by splitting the constructor call.

I get the following warning:

/home/drwells/Documents/Code/CPP/dealii-dev/source/base/mpi.cc: In static member function 'static constexpr void dealii::Utilities::MPI::create_mpi_data_type_n_bytes(std::size_t)::<lambda(ompi_datatype_t**)>::_FUN(ompi_datatype_t**)':
/home/drwells/Documents/Code/CPP/dealii-dev/source/base/mpi.cc:384:15: warning: 'this' pointer is null [-Wnonnull]
  384 |               }};
      |               ^
/home/drwells/Documents/Code/CPP/dealii-dev/source/base/mpi.cc:376:15: note: in a call to non-static member function 'dealii::Utilities::MPI::create_mpi_data_type_n_bytes(std::size_t)::<lambda(ompi_datatype_t**)>'
  376 |               [](MPI_Datatype *p) {
      |               ^

This isn't a problem since deleters don't store any kind of state but we can
work around it by splitting the constructor call.
@drwells
Copy link
Member Author

drwells commented Jan 24, 2022

/rebuild

@bangerth
Copy link
Member

How bizarre. Thanks for fixing it!

@bangerth bangerth merged commit 7614201 into dealii:master Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants