‘struct evaluator’ violates the C++ One Definition Rule

Summary

This is a long standing issue that I can trace back to Eigen 3.3.5. While compiling Ceres Solver 2.2.0 using link time optimization (-flto=auto) the compiler is issuing the following warning over and over:

/home/sergiu/Projects/eigen/Eigen/src/Core/ProductEvaluators.h:31:8: warning: type ‘struct evaluator’ violates the C++ One Definition Rule [-Wodr]
   31 | struct evaluator<Product<Lhs, Rhs, Options>> : public product_evaluator<Product<Lhs, Rhs, Options>> {
      |        ^

Unfortunately, there is no other context and it is not clear how to reproduce the issue.

Environment

  • Operating System : Linux
  • Architecture : x86_64
  • Eigen Version : bea7f7c5
  • Compiler Version : GCC 15.2.1
  • Compile Flags : -O3 -DNDEBUG -flto=auto -fuse-ld=mold
  • Vector Extension : SSE2