unrecognizable template declaration/definition "traits"

Summary

Hi, I'm vcpkg maintainer, we received an issue about using eigen (issue: https://github.com/microsoft/vcpkg/issues/12116):

Environment

  • Operating System : Windows
  • Architecture : x64
  • Eigen Version : 3.3.9
  • Compiler Version : Visual Studio 2017
  • Compile Flags : -Od -march=native
  • Vector Extension : by default ...

Minimal Example

...
#include <eigen3/Eigen/src/Core/Array.h>
...

Steps to reproduce

  1. ./vcpkg install eigen3
  2. add the code above
  3. build project

What is the current bug behavior?

Build failure.

What is the expected correct behavior?

Build success.

Relevant logs

1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2988: unrecognizable template declaration/definition
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2143: syntax error: missing ';' before '<'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2059: syntax error: '<'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2065: 'Matrix': undeclared identifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2065: '_Scalar': undeclared identifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2065: '_Rows': undeclared identifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2065: '_Cols': undeclared identifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2065: '_Options': undeclared identifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2065: '_MaxRows': undeclared identifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2065: '_MaxCols': undeclared identifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2974: 'Eigen::internal::traits': invalid template argument for '_Scalar', type expected
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): note: see declaration of 'Eigen::internal::traits'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2975: '_Rows': invalid template argument for 'Eigen::internal::traits', expected compile-time constant expression
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(16): note: see declaration of '_Rows'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2975: '_Cols': invalid template argument for 'Eigen::internal::traits', expected compile-time constant expression
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(16): note: see declaration of '_Cols'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2975: '_Options': invalid template argument for 'Eigen::internal::traits', expected compile-time constant expression
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(16): note: see declaration of '_Options'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2975: '_MaxRows': invalid template argument for 'Eigen::internal::traits', expected compile-time constant expression
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(16): note: see declaration of '_MaxRows'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2975: '_MaxCols': invalid template argument for 'Eigen::internal::traits', expected compile-time constant expression
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(16): note: see declaration of '_MaxCols'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(17): error C2059: syntax error: '>'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(18): error C2143: syntax error: missing ';' before '{'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(18): error C2447: '{': missing function header (old-style formal list?)
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(46): error C3861: 'PlainObjectBase': identifier not found
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(256): note: see reference to class template instantiation 'Eigen::Array<_Scalar,_Rows,_Cols,_Options,_MaxRows,_MaxCols>' being compiled
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(46): error C2143: syntax error: missing ',' before '<'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(50): error C2143: syntax error: missing ';' before '<'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(50): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(50): error C2238: unexpected token(s) preceding ';'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(53): error C2143: syntax error: missing ';' before 'enum [tag]'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(53): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(53): warning C4183: 'EIGEN_DENSE_PUBLIC_INTERFACE': missing return type; assumed to be a member function returning 'int'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(54): error C2653: 'Base': is not a class or namespace name
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(54): error C3646: 'PlainObject': unknown override specifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(54): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(58): error C2039: 'conservative_resize_like_impl': is not a member of 'Eigen::internal'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(15): note: see declaration of 'Eigen::internal'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(58): error C2365: 'Eigen::internal': redefinition; previous definition was 'namespace'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(15): note: see declaration of 'Eigen::internal'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(58): error C2146: syntax error: missing ';' before identifier 'conservative_resize_like_impl'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(58): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(60): error C2653: 'Base': is not a class or namespace name
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(64): error C2653: 'Base': is not a class or namespace name
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(65): error C2653: 'Base': is not a class or namespace name
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(66): error C2653: 'Base': is not a class or namespace name
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(76): error C2061: syntax error: identifier 'EIGEN_STRONG_INLINE'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(77): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(90): error C3646: 'EIGEN_STRONG_INLINE': unknown override specifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(90): error C3646: 'Array': unknown override specifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(90): error C2988: unrecognizable template declaration/definition
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(90): error C2143: syntax error: missing ';' before '&'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(90): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(91): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(107): error C2061: syntax error: identifier 'EIGEN_STRONG_INLINE'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(108): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(116): error C3646: 'EIGEN_STRONG_INLINE': unknown override specifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(116): error C3646: 'Array': unknown override specifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(116): error C2988: unrecognizable template declaration/definition
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(116): error C2143: syntax error: missing ';' before '&'
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(116): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(117): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(132): error C3646: 'EIGEN_STRONG_INLINE': unknown override specifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(132): error C3646: 'Array': unknown override specifier
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(132): error C2988: unrecognizable template declaration/definition
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(132): error C2059: syntax error: '('
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(132): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>f:\vcpkg\installed\x86-windows\include\eigen3\eigen\src\core\array.h(256): fatal error C1903: unable to recover from previous error(s); stopping compilation

Warning Messages

N/A

Benchmark scripts and results

N/A

Anything else that might help

  • Have a plan to fix this issue.

I think this is an eigen bug, can anyone take a look?

Thanks.