Template argument deduction: incomplete type ‘Eigen::internal::traits<U>’ used in nested name specifier (C++17)
Submitted by Marc Schmitt
Assigned to Nobody
Link to original bugzilla bug (#1676)
Description
// Crosspost of: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84075
We encounter an error when serializing an Eigen matrix with boost::serialization.
See: https://stackoverflow.com/questions/54534047/eigen-matrix-boostserialization-c17
The problem seems to be connected with the (changed? new?) template argument deduction for C++17 starting from GCC7.1
The same code compiles successfully with clang and GCC6 (regardless of the C++ version) or in c++14 mode
A simplified test-case (without boost):
// ------------------------------------------
// test-case (see: https://stackoverflow.com/a/54536756/1267320)
#include <Eigen/Core>
template<template<class U>class SPT>void f(SPT<class U>&);
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
void f(Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> & arMatrix){}
int main()
{
Eigen::Matrix2d m;
f(m);
}
// ------------------------------------------
The problem seems to be a bug in GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84075), but maybe Eigen should/could provide a workaround for GCC in C++17 mode?