[Issue 10674] New: getopt does not work for enum type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 19 07:48:18 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10674

           Summary: getopt does not work for enum type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: ttanjo at gmail.com


--- Comment #0 from Tomoya Tanjo <ttanjo at gmail.com> 2013-07-19 07:48:17 PDT ---
In the document of std.getopt.getopt it recognizes enum types but the following
code does not work in dmd v2.064-devel-de68798 on Linux 64bit.

---
import std.getopt;

void main()
{
    auto args = ["--color=yes"];

    // The following code is in the document of getopt
    enum Color { no, yes }
    Color color; // default initialized to Color.no
    getopt(args, "color", &color);

    assert(color == Color.yes); // failed!
}
---

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


More information about the Digitalmars-d-bugs mailing list