This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1764 - Use builtin C++ feature tests to check availability of language features
Summary: Use builtin C++ feature tests to check availability of language features
Status: DECISIONNEEDED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.5 (future version)
Hardware: All All
: Low Internal Design
Assignee: Nobody
URL: https://en.cppreference.com/w/cpp/fea...
Whiteboard:
Keywords:
Depends on:
Blocks: 3.5
  Show dependency treegraph
 
Reported: 2019-10-30 15:01 UTC by Christoph Hertzberg
Modified: 2019-12-04 18:52 UTC (History)
3 users (show)



Attachments

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.

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