www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3308] New: Enum.RED.stringof gives "Enum", not "Enum.RED"

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3308

           Summary: Enum.RED.stringof gives "Enum", not "Enum.RED"
           Product: D
           Version: 2.032
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: echochamber gmail.com


--- Comment #0 from MIURA Masahiro <echochamber gmail.com> 2009-09-08 19:29:54
PDT ---
The sample code in ".stringof Property" section in property.html:

---- cut here ----
module test;

import std.stdio;

struct Foo { }

enum Enum { RED }

typedef int myint;

void main()
{
    writefln((1+2).stringof);       // "1 + 2"
    writefln(Foo.stringof);         // "Foo"
    writefln(test.Foo.stringof);    // "test.Foo"
    writefln(int.stringof);         // "int"
    writefln((int*[5][]).stringof); // "int*[5][]"
    writefln(Enum.RED.stringof);    // "Enum.RED"
    writefln(test.myint.stringof);  // "test.myint"
    writefln((5).stringof);         // "5"
}
---- cut here ----

(I added 'module' and 'import' to make it compilable.)

Actual output:

---- cut here ----
1 + 2
Foo
Foo
int
int*[5u][]
Enum
myint
5
---- cut here ----

- Enum.RED.stringof gives "Enum", not "Enum.RED".
- Module name "test" is not output.
- 5u instead of 5.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 08 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3308


Jarrett Billingsley <jarrett.billingsley gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jarrett.billingsley gmail.c
                   |                            |om


--- Comment #1 from Jarrett Billingsley <jarrett.billingsley gmail.com>
2009-09-08 19:49:46 PDT ---
I'm not sure if this is a duplicate of bug 2881 or if it's just closely
related. Or if this has just been known for so long but somehow never reported.

I always wonder why the compiler seems to hate enums in so many ways..

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 08 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3308


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #2 from bearophile_hugs eml.cc 2010-06-02 14:48:13 PDT ---
See also bug 4261

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 02 2010