error C2373 occurrs in Visual Studio 2022

Summary

Environment

  • Operating System : Windows 10
  • Architecture : x64
  • Eigen Version : 3.3.9
  • Compiler Version : Visual Studio 2022
  • Compile Flags :
  • Vector Extension :

Minimal Example

//show your code here

Steps to reproduce

  1. first step
  2. second step
  3. ...

What is the current bug behavior?

I was compiling the OpenCV library that utilizes eigen, using Visual C++ 2022. Everything worked fine yesterday. But after this commit- "Replace Eigen type metaprogramming with corresponding std types and make use of alias templates", error C2373 occurred.

What is the expected correct behavior?

Relevant logs

C:\Program Files\Eigen3\include\eigen3\Eigen\src/Core/Transpose.h(197,21): error C2373: “Eigen::DenseBase::transpose”: redefinition; different type modifiers C:\Program Files\Eigen3\include\eigen3\Eigen\src/Core/DenseBase.h(319): message : see the declaration of “Eigen::DenseBase::transpose” C:\Program Files\Eigen3\include\eigen3\Eigen\src/Core/Diagonal.h(197,22): error C2373: “Eigen::MatrixBase::diagonal”: redefinition; different type modifiers C:\Program Files\Eigen3\include\eigen3\Eigen\src/Core/MatrixBase.h(213): message : see the declaration of “Eigen::MatrixBase::diagonal”

Anything else that might help

  • Have a plan to fix this issue.