[Issue 9339] std.random.uniform!Enum should return random enum member

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 17 21:21:52 PST 2013


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



--- Comment #12 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-01-17 21:21:50 PST ---
(In reply to comment #11)
> I don't understand. If you use that line in uniform(), and it works, then
> unittests shouldn't have any problems either, no?

The problem is the enum has to be hidden in a unittest block like so:

version(unittest)
{
   enum TestEnum { ... }
}

unittest
{
    foreach (_; 0 .. 100)
        assert(uniform!TestEnum() == ...);
}

And this causes linking problems due to Issue 6057.

-- 
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