View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0003396 | Spring engine | General | public | 2013-01-12 12:58 | 2013-01-18 18:44 | ||||
Reporter | MadrMan | ||||||||
Assigned To | abma | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0003396: Compile error on VS2012 | ||||||||
Description | I've been trying to compile latest develop with VS2012, and I've been getting an error: rts/Game/TraceRay.h(20): error C2057: expected constant expression Which is at the end of this enum: enum { NOENEMIES = 1, NOFRIENDLIES = 2, NOFEATURES = 4, NONEUTRALS = 8, NOGROUND = 16, BOOLEAN = 32, // skip further testings after the first collision NOUNITS = NOENEMIES | NOFRIENDLIES | NONEUTRALS }; I've tracked this down to System/Misc/BitwiseEnum.h being included which has this defined: template <class Enum> inline BitwiseEnum<Enum> operator | (Enum a, Enum b) { return BitwiseEnum<Enum>(a) | BitwiseEnum<Enum>(b); } Apparently, VS2012 applies that global operator to the enum definition, causing it to give an error as the result of that isn't an integral value. Same problem as here: http://stackoverflow.com/questions/13827599/oaidl-h319-error-c2057-expected-constant-expression There are 2 ways to solve this from what I've found. * Stick BitwiseEnums in a namespace so the global operator isn't applied by default (not sure if the global operator can even be used in that case without having to use the entire namespace) * Change the enum to 'enum class' when C++0x is available, as it seems to be compile fine when i do so. Suggestions are very welcome. | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
MadrMan (developer) 2013-01-12 13:12 |
Upon further testing, it seems that the BitwiseEnums inclusion also breaks an enum or two in boost, so changing to enum class won't help much. |
abma (administrator) 2013-01-15 08:12 Last edited: 2013-01-15 08:13 |
so, just put it in a namespace as it seems to be the only solution?! i don't see any drawbacks... |
zerver (reporter) 2013-01-16 18:14 |
I don't have 2012, but let me guess this works? NOUNITS = (int)NOENEMIES | NOFRIENDLIES | NONEUTRALS |
MadrMan (developer) 2013-01-18 14:45 |
zerver, no it doesn't. the error is on the actual enum not in the code where it is used. Opened a pull request with all the fixes i needed to make to get it to compile & run for me in vs2012 (which weren't a lot) |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2013-01-12 12:58 | MadrMan | New Issue | |
2013-01-12 13:12 | MadrMan | Note Added: 0009593 | |
2013-01-15 08:12 | abma | Note Added: 0009598 | |
2013-01-15 08:13 | abma | Note Edited: 0009598 | View Revisions |
2013-01-16 18:14 | zerver | Note Added: 0009601 | |
2013-01-18 14:45 | MadrMan | Note Added: 0009613 | |
2013-01-18 18:44 | MadrMan | Changeset attached | => spring develop e08ad975 |
2013-01-18 18:44 | abma | Changeset attached | => spring develop c610ea77 |
2013-01-18 18:44 | abma | Assigned To | => abma |
2013-01-18 18:44 | abma | Status | new => resolved |
2013-01-18 18:44 | abma | Resolution | open => fixed |