PermutationMatrix<>::transpose() product causes compilation error
Submitted by Sergiu Deitsch
Assigned to Nobody
Link to original bugzilla bug (#1322)
Version: 3.3 (current stable)
Operating system: Windows
Description
I have encountered a very strange (probably compiler related) issue for which I was not able to create a minimal working example. The code below I extracted to demonstrate the problem compiles just fine in a standalone project.
Nevertheless, I hope someone from the devs knows what is happening here.
I have a piece of code that looks as follows:
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
int main()
{
Eigen::SelfAdjointEigenSolverEigen::Matrix3d solver;
// ...
const Eigen::PermutationMatrix<3, 3> p(Eigen::Vector3i::LinSpaced(0, 2).reverse());
// Works!
p.transpose().operator*(solver.eigenvalues());
// However, the following expression fails:
// p.transpose() * solver.eigenvalues();
}
In Eigen 3.2.x the product of the permutation matrix transpose and a vector compiled without any errors. In Eigen 3.3, however, MSVC issues the following error:
2>d:\projects\eigen\eigen\src/Geometry/Transform.h(1443): error C2039: 'Scalar': is not a member of 'Eigen::Inverse<Derived>'
2> with
2> [
2> Derived=Eigen::PermutationMatrix<3,3,int>
2> ]
2> d:\projects\eigen\eigen\src/Core/PermutationMatrix.h(68): note: see declaration of 'Eigen::Inverse<Derived>'
2> with
2> [
2> Derived=Eigen::PermutationMatrix<3,3,int>
2> ]
2> C:\Users\Sergiu\Projects\Tracker\include\vision/calibration.hpp(412): note: see reference to class template instantiation 'Eigen::internal::transform_left_product_implEigen::Inverse<Derived>,2,0,3,4,3,3' being compiled
2> with
2> [
2> Derived=Eigen::PermutationMatrix<3,3,int>
2> ]
If I explicitly call PermutationMatrix<>::operator*, the code compiles (see above example).
It seems that a wrong operator* overload is picked up causing the problem. I also include Eigen/Geometry in my project (the module from which the operator* is falsely chosen, as it seems), but not in the header containing the PermutationMatrix<>::transpose product.
Any ideas?