Skip to content

SIMD test: fix implicit this capture warnings

Jö Fahlke requested to merge fix-implicit-this-capture into master

C++20 deprecates implicit capture of this using [=], and gcc9 warns about that. Unfortunately, in C++ before 20 listing this together with a capture-default of = is illegal, and GCC 8 emits a warning about that that apparently can't be silenced. So the only option if we want to appease both pre- and post-C++20 is to list each entity to be captures explicitly. Luckily, that is not too hard in this case.

See https://gitlab.dune-project.org/core/dune-common/-/jobs/139584#L486 (debian:11 gcc-9-20):

[ 40%] Building CXX object dune/common/CMakeFiles/dunecommon.dir/simd/test.cc.o
In file included from /builds/core/dune-common/dune/common/simd/test.cc:6:
/builds/core/dune-common/dune/common/simd/test.hh: In lambda function:
/builds/core/dune-common/dune/common/simd/test.hh:334:36: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  334 |         Hybrid::forEach(Rebinds{}, [=](auto target) {
      |                                    ^
/builds/core/dune-common/dune/common/simd/test.hh:334:36: note: add explicit 'this' or '*this' capture

WIP:

  • Check these warnings are really gone in the CI
Edited by Jö Fahlke

Merge request reports

Loading