This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1764

Summary: Use builtin C++ feature tests to check availability of language features
Product: Eigen Reporter: Christoph Hertzberg <chtz>
Component: Core - generalAssignee: Nobody <eigen.nobody>
Status: DECISIONNEEDED ---    
Severity: Internal Design CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Low    
Version: 3.5 (future version)   
Hardware: All   
OS: All   
URL: https://en.cppreference.com/w/cpp/feature_test
Whiteboard:
Bug Depends on:    
Bug Blocks: 1683    

Description Christoph Hertzberg 2019-10-30 15:01:01 UTC
A lot of the relatively complicated feature detection code could be simplified by using built-in feature-tests of C++, e.g., 

    // Does the compiler support variadic templates?
    #ifndef EIGEN_HAS_VARIADIC_TEMPLATES
      #if EIGEN_MAX_CPP_VER>=11 && defined(__cpp_variadic_templates)
        #define EIGEN_HAS_VARIADIC_TEMPLATES __cpp_variadic_templates
      #else
        #define EIGEN_HAS_VARIADIC_TEMPLATES 0
      #endif
    #endif

This needs to be tested with older compiler however, and we either need to still add some extra tests, or just un-support compilers which do not support these feature-tests.


https://en.cppreference.com/w/cpp/feature_test
Comment 1 Gael Guennebaud 2019-11-14 16:59:52 UTC
I would not bother until we're done with 3.4 and start 3.5 with an increased minimal c++ version (c++11 or c++14). Such an increase in the minimal c++11 version will allow us to cleanup most of those checks anyway, and then, yes, we should use __cpp_* for c++17/20 features.
Comment 2 Nobody 2019-12-04 18:52:05 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1764.