Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-04-16 07:39:15


> Neither gcc (3.3.3) nor Metrowerks (don't remember version) seems to
> think that "enumVal1 | enumVal2" is an integral constant expression. This
> seems obvious in the case of operator| being overloaded, although Comeau
> online 4.3.3 *does* seem to swallow that without complaint, which greatly
> diminishes my expectations of being right and greatly adds to my
> confusion. However, gcc and Metrowerks seem to ban this even if operator|
> is not overloaded. I haven't found the standardese to motivate that yet.
> Someone set me straight, please!

I couldn't find anything about this except 5.19 where certain specific
operators are banned, by deduction everything else should be legal I guess
(but not overloaded operators obviously). I guess casting the enum types to
int should fix the compiler error (you can even cast back to enum type
afterwards if that's what you want), but obviously that only works if you
know how wide the enum's are.

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk