This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Fix to the "enumeral mismatch" warning

Tags: None
(comma "," separated)
Pompei2
Registered Member
Posts
2
Karma
0
Hello everybody,

I am trying out Eigen. When using the dense matrix class "Matrix", I am spammed by compiler warnings stating the following:

Code: Select all
/home/beyer/thesis/src/Eigen/src/Core/DenseBase.h:103:10: warning: enumeral mismatch in conditional expression: 'Eigen::internal::size_at_compile_time<-1, -1>::<anonymous enum>' vs 'Eigen::internal::traits<Eigen::CwiseBinaryOp<Eigen::internal::scalar_sum_op<float>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_random_op<float>, Eigen::Matrix<float, -1, -1> >, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<float>, Eigen::Matrix<float, -1, -1> > > >::<anonymous enum>' [enabled by default]


This is on Mac OS X using GCC.

I saw your disable stupid warnings header file and liked the idea. So I googled for a switch to disable this warning. Apparently, there is none. The way to fix it is by casting the following way:

Code: Select all
      InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime)
                             : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime),


I don't have a bitbucket account and was too lazy to make one or I'd have made a pull request. Please, if it is a correct one, include this fix in upcoming versions.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
what's your compiler version? I cannot reproduce and I don't understand how there can be any enumeral mismatch here.
Pompei2
Registered Member
Posts
2
Karma
0
Code: Select all
$ /usr/local/macports/bin/g++-mp-4.7 -dumpversion
4.7.0

I too was wondering how the compiler concludes to an enumeral mismatch. I guess it is because the two anonymous enums that the values (which two of the three values? I don't know) resolve to live in different classes thus it assumes they may have different storage types. But that's just a wild guess.

Note that I cannot reproduce it on linux either, only on OS X (10.6).
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
but here all the enumerals are part of the same set of anonymous enums.... anyway gcc 4.7 is still in beta, maybe it would be worth trying on the trunk and perhaps report to them.
chombier
Registered Member
Posts
3
Karma
0
Hello,

The following change makes the warning disappear:

src/Core/DenseBase.h:172

InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime)
: int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime),


Basically, its only a matter of ensuring that all expressions have the same type in the nested conditional.

HTH,


max.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
I still maintain this is GCC issue, and actually I've just recompiled with the last 4.7.0 version (RC?) and this warning disappeared.
bpiwowar
Registered Member
Posts
6
Karma
0
OS
The issue is still there with GCC 4.7.0
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
yes sorry, I made a mistake when re-testing. The workaround is in the devel branch though I maintain this is a gcc issue.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]