In terms of type safety, scoped enum is better than plain enum, but there's one pitfall: the underlying type doesn't get wide automatically.
This would silently fail:
enum class Name {
A = 1LL<<40
};
Name::A would surprisingly be 0.
On the other hand:
enum {
LARGE = 1LL<<40
};
LARGE would be wide enough automatically.
I agree this would be a nice feature if possible. I get sick of doing histogram reviews and having to see/approve them with static_casts because the implementer decided to use an enum class.
Comment 1 by dcheng@chromium.org
, Mar 25 2017