[cfe-dev] Motivation for scoped enum comparison behavior?

Eric Fiselier eric at efcs.ca
Tue Oct 22 13:36:19 PDT 2013


Hi all,

I hope this is the correct mailing list.

I wanted to ask why clang chooses to compare scoped enumerators as if they
were unsigned numbers, even when the underlying type is signed. For example

enum class E : int
{
   neg_one = -1,
   one = 1;
};

neg_one > one; // true

What is the motivation for this behavior?

Best,

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131022/75a1b811/attachment.html>


More information about the cfe-dev mailing list