Both constants are constant, but the expression x isn't constant since it resolves to different constants in different classes. That's just the result of overloading and is a very useful feature. You can make your constants explicitly nomask or local if you want to, or you can resolve them statically using local::x to get a constant expression.