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

Bug 1692

Summary: pass enumeration argument to constructor of VectorXd
Product: Eigen Reporter: Huang Qinjin <huangqinjin>
Component: Core - generalAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Unknown CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 814    

Description Huang Qinjin 2019-03-17 15:07:19 UTC
Currently, the constructor of VectorXd requires Integer by the assertion of NumTraits<T>::IsInteger to specify the length. Will it be fine to releax to any type  that convertible to int, such as a enumeration. The following code gets compilation
error: static assertion failed: FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED.

    enum : int {
        Size = 2,
    }; 

    VectorXd V(Size);
Comment 1 Gael Guennebaud 2019-03-17 15:56:27 UTC
In the devel branch we already have internal::is_valid_index_type<T> for that purposes. It is used to detect singletons in operator(row_indices,col_indices), so we would just have to use that.
Comment 2 Gael Guennebaud 2019-03-17 21:03:40 UTC
Fixed:

  https://bitbucket.org/eigen/eigen/commits/b31bfdc8cd3a/

and backported to 3.3.

Thank you for reporting.
Comment 3 Christoph Hertzberg 2019-03-18 09:50:09 UTC
The unit test does not compile in C++03 mode (due to using anonymous enums, similar to Bug 1549).
But since this was not possible before, we could just disable this test in that case.
Comment 4 Gael Guennebaud 2019-03-18 10:08:42 UTC
yes, I've seen that this morning.
Comment 5 Christoph Hertzberg 2019-03-19 14:00:50 UTC
I think this is also due to that change: smallvectors fails in C++03 mode:

http://manao.inria.fr/CDash/testSummary.php?project=1&name=smallvectors&date=2019-03-19
http://manao.inria.fr/CDash/testSummary.php?project=2&name=smallvectors&date=2019-03-19

Also in C++11 mode with gcc-4.8, but that might as well be an error in gcc.
Comment 6 Nobody 2019-12-04 18:33:37 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/1692.