Skip to content

[eigenvaluetest] Let the standard library handle a thrown exception

Jö Fahlke requested to merge fix-virtual-exception-value-capture into master

Whereas an exception was previously reported as

MathError [testSymmetricFieldMatrix:/home/joe/Projects/dune-simd/dune-common/dune/common/test/eigenvaluestest.cc:91]: huhu

it will now be reported as

terminate called after throwing an instance of 'Dune::MathError'
  what():  MathError [testSymmetricFieldMatrix:/home/joe/Projects/dune-simd/dune-common/dune/common/test/eigenvaluestest.cc:91]: huhu

This fixes a compiler warning from g++ 8 (https://gitlab.dune-project.org/core/dune-common/-/jobs/84728)

/builds/core/dune-common/dune/common/test/eigenvaluestest.cc: In function 'int main()':
/builds/core/dune-common/dune/common/test/eigenvaluestest.cc:134:20: warning: catching polymorphic type 'class Dune::Exception' by value [-Wcatch-value=]
 } catch (Exception exception)
                    ^~~~~~~~~

Merge request reports

Loading