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

[Urgent] Fix 'main' breakage. #5208

Merged
merged 1 commit into from Jul 8, 2023
Merged

[Urgent] Fix 'main' breakage. #5208

merged 1 commit into from Jul 8, 2023

Conversation

bangerth
Copy link
Contributor

@bangerth bangerth commented Jul 8, 2023

This fix breakage such as this that currently trips up #5207 and #5206:

/__w/aspect/aspect/source/particle/property/strain_rate.cc:49:15: error: cannot bind non-const lvalue reference of type 'dealii::ArrayView<double, dealii::MemorySpace::Host>&' to an rvalue of type 'dealii::ArrayView<double, dealii::MemorySpace::Host>'
   49 |         auto &data = particle->get_properties();
      |               ^~~~
/__w/aspect/aspect/source/particle/property/strain_rate.cc: In instantiation of 'void aspect::Particle::Property::StrainRate<dim>::update_particle_property(unsigned int, const dealii::Vector<double>&, const std::vector<dealii::Tensor<1, dim> >&, typename dealii::Particles::ParticleHandler<dim>::particle_iterator&) const [with int dim = 3; typename dealii::Particles::ParticleHandler<dim>::particle_iterator = dealii::Particles::ParticleIterator<3, 3>]':
/__w/aspect/aspect/source/particle/property/strain_rate.cc:96:7:   required from here
/__w/aspect/aspect/source/particle/property/strain_rate.cc:49:15: error: cannot bind non-const lvalue reference of type 'dealii::ArrayView<double, dealii::MemorySpace::Host>&' to an rvalue of type 'dealii::ArrayView<double, dealii::MemorySpace::Host>'
In file included from CMakeFiles/aspect.dir/Unity/unity_24_cxx.cxx:17:
/__w/aspect/aspect/source/particle/property/viscoplastic_strain_invariants.cc: In instantiation of 'void aspect::Particle::Property::ViscoPlasticStrainInvariant<dim>::update_particle_property(unsigned int, const dealii::Vector<double>&, const std::vector<dealii::Tensor<1, dim> >&, typename dealii::Particles::ParticleHandler<dim>::particle_iterator&) const [with int dim = 2; typename dealii::Particles::ParticleHandler<dim>::particle_iterator = dealii::Particles::ParticleIterator<2, 2>]':
/__w/aspect/aspect/source/particle/property/viscoplastic_strain_invariants.cc:232:7:   required from here
/__w/aspect/aspect/source/particle/property/viscoplastic_strain_invariants.cc:133:15: error: cannot bind non-const lvalue reference of type 'dealii::ArrayView<double, dealii::MemorySpace::Host>&' to an rvalue of type 'dealii::ArrayView<double, dealii::MemorySpace::Host>'
  133 |         auto &data = particle->get_properties();
      |               ^~~~

This is caused by dealii/dealii#15671.

auto &data = particle->get_properties();
const auto data = particle->get_properties();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_properties() used to return a const ArrayView<...> object. It isn't a reference, so capturing it with auto & was always a poor design choice. It worked because the compiler deduced auto = const ArrayView, and binding a temporary to a const reference is allowed. But dealii/dealii#15671 changed the return type to drop the const, which means that the compiler deduces auto = ArrayView, and now we have a non-const reference for which the returned temporary is no longer able to bind -- and the compiler errors out.

@tjhei tjhei merged commit f5f9320 into geodynamics:main Jul 8, 2023
6 checks passed
@bangerth bangerth deleted the fix branch July 8, 2023 15:40
@tjhei tjhei mentioned this pull request Jul 8, 2023
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