[cfe-dev] Motivation for scoped enum comparison behavior?
Karen Shaeffer
shaeffer at neuralscape.com
Tue Oct 22 14:56:51 PDT 2013
On Tue, Oct 22, 2013 at 03:41:17PM -0600, Eric Fiselier wrote:
> Thanks Richard, I was unsure if it was a bug since the standard seems to be
> ambiguous about how to compare scoped enumerations (making no mention about
> the underlying type).
Hi Eric,
In the Standard at [expr]
<5 note 9>
Many binary operators that expect operands of arithmetic or enumeration type cause conversions and yield result types in a similar way. The purpose is to yield a common type, which is also the type of the result. This pattern is called the usual arithmetic conversions, which are defined as follows:
— If either operand is of scoped enumeration type (7.2), no conversions are performed; if the other operand does not have the same type, the expression is ill-formed.
enjoy,
Karen
--
Karen Shaeffer Be aware: If you see an obstacle in your path,
Neuralscape Services that obstacle is your path. Zen proverb
More information about the cfe-dev
mailing list