http://d.puremagic.com/issues/show_bug.cgi?id=3999
--- Comment #3 from bearophile_h...@eml.cc 2010-09-01 15:13:03 PDT --- This simple example shows a possible way to implement this (currently with dmd 2.048 this program runs firing no asserts): enum V1 = 10; enum { V2 = 20 } enum : int { V2b = 25 } enum { V3a = 20, V3b = 30 } enum Foo { V4 } enum Color : int { red, green, blue } void main() { assert(V1 == 10); // OK assert(V2 == 20); // OK assert(V2b == 25); // OK assert(V3b == 30); // OK assert(Foo.V4 == 0); // ERROR, type mismatch assert(Color.green == 1); // ERROR, type mismatch } So this bug 3999 is meant to restrict only the last two examples, where the EnumTag is present in the enum definition. All other enum usages are unchanged by this proposal. See also the ideas behind the design of the C++0x "enum class". One of the purposes of "enum class" is to remove implicit conversions to int: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1719.pdf If bug bug 3999 gets accepted, then bug 4261 too may be considered, because then enums aren't "values" but symbols, and the most natural way to print them on default becomes their name. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------