New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 853 - MSVC 2013 generates an error with "Traits::template match<Derived>::MatchAtCompileTime" in src/Core/Ref.h
MSVC 2013 generates an error with "Traits::template match<Derived>::MatchAtCo...
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - general
3.2
All Windows
: Normal Compilation Problem
Assigned To: Nobody
: Compatibility
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-11 16:43 UTC by Kenshi Takayama
Modified: 2014-11-05 16:17 UTC (History)
3 users (show)



Attachments

Description Kenshi Takayama 2014-08-11 16:43:56 UTC
MSVC 2013 produces errors with the following code:

--------------------------

#include <Eigen/Sparse>
using namespace Eigen;
int main() {
    SparseMatrix<double> m;
    SparseLU<decltype(m)> lu;
    lu.compute(m);
}

--------------------------

Errors occur where this expression "Traits::template match<Derived>::MatchAtCompileTime" appears in src/Core/Ref.h. The errors go away when that expression is replaced by "Traits::match<Derived>::MatchAtCompileTime". I'm not sure if MSVC is violating the Standard, but I'd appreciate greatly if this issue is taken care of in the Eigen codebase.

Best,
Kenshi
Comment 1 Gael Guennebaud 2014-08-21 09:45:49 UTC
MSVC is indeed violating the standard here, and removing the template keyword makes all other compilers fail to compile. Have you installed all updates?

Could someone else confirm this issue?
Comment 2 Christoph Hertzberg 2014-11-03 15:55:59 UTC
Can we hide the enable_if construct somehow in an internal function (cf Bug 903), or couldn't we actually use a static assert here?
Comment 3 Gael Guennebaud 2014-11-05 16:17:49 UTC
Hopefully this is enough to workaround MSVC weirdness. Feel free to reopen if that's still broken.

https://bitbucket.org/eigen/eigen/commits/06d4fff20a93/
Changeset:   06d4fff20a93
User:        ggael
Date:        2014-11-05 15:15:17+00:00
Summary:     Big 853: replace enable_if in Ref<> ctor by static assertions and add failtests for Ref<>

Note You need to log in before you can comment on or make changes to this bug.