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::SelfAdjointEigenSolver<Eigen::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_impl<Eigen::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?
This happens with 97c1ebe6ccc2.
I cannot find any revision starting with 97c1. Please, could you try with the head of the default (3.3) branch to make sure the issue has not been already fixed?
Sorry, I forgot to update my repo, rev 97c1ebe6ccc2 is indeed very recent.
Your error message is a complete non sense to me: 1 - it tries to instantiate transform_left_product_impl<>, but this class is returned only by Transform::operator*, no free operator*. 2 - this means it first converted a Vector3d to a Transform, but the only non explicit Transform ctors are from Transform objects. So really, I clueless about how MSVC managed to instantiate this code. Is it the full error message?
It's pretty much the full error message. I left out the remaining log output which provides only the stack trace of template instantiations specific to my code. I will try to further investigate the problem. Any pointers where I should start are highly appreciated.
Some idea to try: 1 - in file src/Core/Inverse.h, add: using Base::operator* to class InversE. 2 - You could try to comment some ctors of Transform to identify which one is instantiated (without breaking the rest of your code!).
Thanks for your suggestions. I was able to isolate the code that causes compilation errors, and this is getting really weird. The above example is mostly unchanged: #include <Eigen/Core> #include <Eigen/Eigenvalues> #include <Eigen/Geometry> int main() { Eigen::Affine3d t; // Remove to compile. Eigen::SelfAdjointEigenSolver<Eigen::Matrix3d> solver; // ... const Eigen::PermutationMatrix<3, 3> p(Eigen::Vector3i::LinSpaced(0, 2).reverse()); p.transpose() * solver.eigenvalues(); } The code fails to compile with the additional Eigen::Affine3d variable definition. The command-line and the full error: D:\Projects\eigen>cl test.cpp -I. /EHsc Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86 Copyright (C) Microsoft Corporation. All rights reserved. test.cpp d:\projects\eigen\eigen\src/Geometry/Transform.h(1443): error C2039: 'Scalar': is not a member of 'Eigen::Inverse<Derived>' with [ Derived=Eigen::PermutationMatrix<3,3,int> ] d:\projects\eigen\eigen\src/Core/PermutationMatrix.h(68): note: see declaration of 'Eigen::Inverse<Derived>' with [ Derived=Eigen::PermutationMatrix<3,3,int> ] test.cpp(12): note: see reference to class template instantiation 'Eigen::internal::transform_left_product_impl<Eigen::Inverse<Derived>,2,0,3,4,3,3>' being compiled with [ Derived=Eigen::PermutationMatrix<3,3,int> ] d:\projects\eigen\eigen\src/Geometry/Transform.h(1443): error C2146: syntax error: missing '>' before identifier 'Scalar' If you remove the Eigen::Affine3d variable, the code compiles.
This is worth reporting to MSVC developers. On Eigen's side it will take time to find a workaround, if any. On your side, you can split the code in two different cpp file (admittedly, this might be really inconvenient).
I've reported the issue 2 years ago: https://developercommunity.visualstudio.com/content/problem/50644/eigen-333-code-not-compile.html. No resolution as of today.
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1322.