Skip to content

Bugfix/fix inconsistent 1d dense vector conversions

This merge-request provides a test and a fix for bugs in DenseVector / FieldVector where the implementation "claims" to be convertible or assignable but instantiating the "advertised" assignment or conversion fails.

  • std::is_convertible<From, To> is true_type, but the constructor "To(From)" fails
  • std::is_assignable<To, From> is true_type, but "To = From" fails.

The bug is caused by catch-all templates in the 1d-version of FieldVector and the operator=() of DenseVector where "constructibility" resp. "assignability" by arbitray DenseVector implementations is claimed, but as that cannot work out anyway the actual call of the respective method triggers a compiler error.

The fix attacks this by requiring that DenseVector::value_type can be assigned/constructed by DenseVector::value_type. The buggy methods in questions do user operator, so this seems a reasonable fix.

The error is particularly triggered when nesting vector and trying to assign to a nested FieldVector from another nested DenseVector

Edited by Claus-Justus Heine

Merge request reports