digitalmars.D.bugs - [Issue 1610] New: Enum.stringof is int, not the name of the enum
- d-bugmail puremagic.com (18/18) Oct 24 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1610
- Ary Manzana (20/43) Oct 24 2007 lol, I just discovered the same thing yesterday.
- d-bugmail puremagic.com (11/11) Jul 22 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1610
- d-bugmail puremagic.com (9/9) Jul 22 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1610
- Koroskin Denis (3/12) Jul 22 2008 I thought version is meant to be the *earliest* version known to have th...
- BCS (4/21) Jul 22 2008 Setting the version to the latest minor version shows active interest an...
- Bill Baxter (5/29) Jul 22 2008 You can show interest just by posting a comment saying "halloo! this bug...
- Brad Roberts (9/40) Jul 22 2008 On the other hand, this is one of the few cases of changing the version
- BCS (3/14) Jul 22 2008 maybe there should be 4 versions [ :b ] reported and latest-verified for...
- d-bugmail puremagic.com (9/9) Dec 07 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1610
http://d.puremagic.com/issues/show_bug.cgi?id=1610 Summary: Enum.stringof is int, not the name of the enum Product: D Version: 2.007 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: andrei metalanguage.com import std.stdio; enum ABC { a, b, c } void main() { writeln(ABC.stringof); } // prints "int" This causes major issues in reflective and serialization code. The .stringof should evaluate to the name of the enum, e.g. "ABC". --
Oct 24 2007
d-bugmail puremagic.com escribió:http://d.puremagic.com/issues/show_bug.cgi?id=1610 Summary: Enum.stringof is int, not the name of the enum Product: D Version: 2.007 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: andrei metalanguage.com import std.stdio; enum ABC { a, b, c } void main() { writeln(ABC.stringof); } // prints "int" This causes major issues in reflective and serialization code. The .stringof should evaluate to the name of the enum, e.g. "ABC".lol, I just discovered the same thing yesterday. I found out you can also do this: void foo() { int x = typeof(ABC).a; // same as ABC.a int y = typeof(ABC).init; // y = 0 } The compiler also allows me to do this: enum ABCInit { a, b, c, init } Now if I do: void foo() { int y = typeof(ABC).init; // y = 3 } So an addition of a field "init" could potentialy and silently introduce bugs in the application. Although I think it's rare that someone would want to define an "init" property for an enum type (or for a class, or struct), I think the compiler should disallow this (same behaviour as trying to redefine the "sizeof", "alignof", etc., properties).
Oct 24 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1610 ------- Comment #2 from moritzwarning web.de 2008-07-22 12:51 ------- I have to deal with this problem in a template function that is used with a lot of different enum types (by some other bigger templates). But not handled enum types hit a static assert. I wrote different template functions before but hit some limitations that forced me to put everything in the same function using static ifs. Because T.stringof is almost always "int", I have a hard time to find out what enum is not handled. I hope this problem will be addressed soon. --
Jul 22 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1610 shro8822 vandals.uidaho.edu changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Linux |All Version|2.007 |1.033 ------- Comment #3 from shro8822 vandals.uidaho.edu 2008-07-22 13:26 ------- this issue is also in latest V1 so switching the version to that --
Jul 22 2008
On Tue, 22 Jul 2008 22:26:13 +0400, <d-bugmail puremagic.com> wrote:http://d.puremagic.com/issues/show_bug.cgi?id=1610 shro8822 vandals.uidaho.edu changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Linux |All Version|2.007 |1.033 ------- Comment #3 from shro8822 vandals.uidaho.edu 2008-07-22 13:26 ------- this issue is also in latest V1 so switching the version to thatI thought version is meant to be the *earliest* version known to have the bug, not the latest one....
Jul 22 2008
Reply to Koroskin,On Tue, 22 Jul 2008 22:26:13 +0400, <d-bugmail puremagic.com> wrote:Setting the version to the latest minor version shows active interest and that the bug hasn't magically disappeared. OTOH, IMHO the oldest major version that the bug should be fixed in should be tagged to indicate that.http://d.puremagic.com/issues/show_bug.cgi?id=1610 shro8822 vandals.uidaho.edu changed: What |Removed |Added --------------------------------------------------------------------- ------- OS/Version|Linux |All Version|2.007 |1.033 ------- Comment #3 from shro8822 vandals.uidaho.edu 2008-07-22 13:26 ------- this issue is also in latest V1 so switching the version to thatI thought version is meant to be the *earliest* version known to have the bug, not the latest one....
Jul 22 2008
BCS wrote:Reply to Koroskin,You can show interest just by posting a comment saying "halloo! this bug has been around since version 0.123, and it's still there in 1.latest. Any chance for a fix?". --bbOn Tue, 22 Jul 2008 22:26:13 +0400, <d-bugmail puremagic.com> wrote:Setting the version to the latest minor version shows active interest and that the bug hasn't magically disappeared. OTOH, IMHO the oldest major version that the bug should be fixed in should be tagged to indicate that.http://d.puremagic.com/issues/show_bug.cgi?id=1610 shro8822 vandals.uidaho.edu changed: What |Removed |Added --------------------------------------------------------------------- ------- OS/Version|Linux |All Version|2.007 |1.033 ------- Comment #3 from shro8822 vandals.uidaho.edu 2008-07-22 13:26 ------- this issue is also in latest V1 so switching the version to thatI thought version is meant to be the *earliest* version known to have the bug, not the latest one....
Jul 22 2008
Bill Baxter wrote:BCS wrote:On the other hand, this is one of the few cases of changing the version that is probably a good idea. It was reported against 2.x and has been shifted over to 1.x. That it's not a 2.x specific bug is useful info. Otherwise, Bill is right. Do NOT shift a version number to a higher version just to show interest as thats not helpful. A ping and a note that it's still broken is sufficient. Later, BradReply to Koroskin,You can show interest just by posting a comment saying "halloo! this bug has been around since version 0.123, and it's still there in 1.latest. Any chance for a fix?". --bbOn Tue, 22 Jul 2008 22:26:13 +0400, <d-bugmail puremagic.com> wrote:Setting the version to the latest minor version shows active interest and that the bug hasn't magically disappeared. OTOH, IMHO the oldest major version that the bug should be fixed in should be tagged to indicate that.http://d.puremagic.com/issues/show_bug.cgi?id=1610 shro8822 vandals.uidaho.edu changed: What |Removed |Added --------------------------------------------------------------------- ------- OS/Version|Linux |All Version|2.007 |1.033 ------- Comment #3 from shro8822 vandals.uidaho.edu 2008-07-22 13:26 ------- this issue is also in latest V1 so switching the version to thatI thought version is meant to be the *earliest* version known to have the bug, not the latest one....
Jul 22 2008
Reply to Brad,On the other hand, this is one of the few cases of changing the version that is probably a good idea. It was reported against 2.x and has been shifted over to 1.x. That it's not a 2.x specific bug is useful info. Otherwise, Bill is right. Do NOT shift a version number to a higher version just to show interest as thats not helpful. A ping and a note that it's still broken is sufficient. Later, Bradmaybe there should be 4 versions [ :b ] reported and latest-verified for v1 and v2
Jul 22 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1610 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #4 from bugzilla digitalmars.com 2008-12-08 00:53 ------- Fixed in DMD 1.037 and 2.021 --
Dec 07 2008