C++11 enum class instantiation
问题 I've encountered the following form of enum class variable instantiation and it is compiling without any warning or error under VS2012: UINT32 id; enum class X {apple, pear, orange}; X myX = X(id); Moreover, sending X(id) as an argument to a function expecting X type param compiled as well. I'm not sure if the result is always correct or it's just a strange compiler behavior. However, trying to do X myX(id); instead of the above resulted in compilation error: error C2440: 'initializing' :