https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84075

Marc Schmitt <schmitt.marc at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schmitt.marc at gmail dot com

--- Comment #5 from Marc Schmitt <schmitt.marc at gmail dot com> ---
Hi,

we encountered a the same bug.

See:
https://stackoverflow.com/questions/54534047/eigen-matrix-boostserialization-c17

The bug is reproducible with G++8. 

The bug seems to be related with the (new?) template argument deduction
mechanism in G++7/8 with --std=c++17 (or --std=gnu++17).

A simplified test case (thx @Marc Giese/SO), reproducing the problem just
including Eigen without the boost dependency is attached (see below).

// --------------------------------------------
// G++ 7
// --------------------------------------------

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-7
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)


// --------------------------------------------
// G++ 8
// --------------------------------------------

$ g++-8 -v
Using built-in specs.
COLLECT_GCC=g++-8
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
8.2.0-1ubuntu2~18.04' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-8
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 8.2.0 (Ubuntu 8.2.0-1ubuntu2~18.04)

// --------------------------------------------
// testcase (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);
}

// --------------------------------------------
compile with: (G++7 or G++8)
g++ -std=c++17 main.cpp

// --------------------------------------------
Error output:

$ g++ -std=c++17 main.cpp
In file included from /usr/local/include/Eigen/Core:365:0,
                 from main.cpp:1:
/usr/local/include/Eigen/src/Core/util/ForwardDeclarations.h: In instantiation
of ‘struct Eigen::internal::accessors_level<U>’:
main.cpp:9:8:   recursively required by substitution of
‘template<template<class U> class SPT> void f(SPT<U>&) [with SPT = <missing>]’
main.cpp:9:8:   required from here
/usr/local/include/Eigen/src/Core/util/ForwardDeclarations.h:32:54: error:
incomplete type ‘Eigen::internal::traits<U>’ used in nested name specifier
   enum { has_direct_access = (traits<Derived>::Flags & DirectAccessBit) ? 1 :
0,
                              ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/local/include/Eigen/src/Core/util/ForwardDeclarations.h:33:53: error:
incomplete type ‘Eigen::internal::traits<U>’ used in nested name specifier
          has_write_access = (traits<Derived>::Flags & LvalueBit) ? 1 : 0,
                             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

// --------------------------------------------
// Preprocessed code
// --------------------------------------------
compiled with: g++ -std=c++17 -E main.cpp > pp_main_minimal.ii

See the attached pp_main_minimal.ii

Reply via email to