Cannot multiply DiagonalWrapper and selfadjointView()

Summary

Is there a reason it's not possible to multiply a DiagonalWrapper and SelfAdjointView<> type?

In the godbolt link below I can multiply an Eigen matrix and a self adjoint view, but when I change the matrix to be a vector made from a DiagonalWrapper Eigen fails to compile because it cannot find the correct operator*

https://godbolt.org/z/vnbx1voE5

    Eigen::MatrixXd A = Eigen::MatrixXd::Random(4,4);
    Eigen::VectorXd b = Eigen::VectorXd::Random(4);
    // This works
    // Eigen::MatrixXd C = A * A.selfadjointView<Eigen::Upper>();
    // This does not
    Eigen::MatrixXd C = b.asDiagonal() * A.selfadjointView<Eigen::Upper>();

Environment

  • Operating System : Godbolt
  • Eigen Version : 3.4
  • Compiler Version : Gcc11.1
  • Compile Flags : -O3 -std=c++11

Steps to reproduce

Reproducible in godbolt.

What is the current bug behavior?

Fail to compile

What is the expected correct behavior?

Compiles

Relevant logs

See error on godbolt

  • Have a plan to fix this issue.