[Bug c++/84075] Template parameter not resolved: invalid application of ‘sizeof’ to incomplete type ‘boost::serialization::U’

2019-02-06 Thread schmitt.marc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84075

Marc Schmitt  changed:

   What|Removed |Added

 CC||schmitt.marc at gmail dot com

--- Comment #5 from Marc Schmitt  ---
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 

templateclass SPT>void f(SPT&);
template
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’:
main.cpp:9:8:   recursively required by substitution of
‘template class SPT> void f(SPT&) [with SPT = ]’
main.cpp:9:8:   required from here
/usr/local/include/Eigen/src/Core/util/ForwardDeclarations.h:32:54: error:
incomplete type ‘Eigen::internal::traits’ used in nested name specifier
   enum { has_direct_access = (traits::Flags & DirectAccessBit) ? 1 :
0,
  ^~
/usr/local/include/Eigen/src/Core/util/ForwardDeclarations.h:33:53: error:
incomplete type ‘Eigen::internal::traits’ used in nested name specifier
  has_wr

[Bug c++/84075] Template parameter not resolved: invalid application of ‘sizeof’ to incomplete type ‘boost::serialization::U’

2019-02-06 Thread schmitt.marc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84075

--- Comment #6 from Marc Schmitt  ---
Created attachment 45618
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45618&action=edit
Reduced test case with eigen-only dependency

[Bug c++/84075] Template parameter not resolved: invalid application of ‘sizeof’ to incomplete type ‘boost::serialization::U’

2019-02-06 Thread schmitt.marc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84075

--- Comment #7 from Marc Schmitt  ---
Created attachment 45619
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45619&action=edit
Preprocessed test case with eigen-only dependency