[Issue 5048] string enum type not recognized as a string

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 18 22:05:29 PDT 2013


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



--- Comment #2 from hsteoh at quickfur.ath.cx 2013-08-18 22:05:28 PDT ---
I added an actual instantiation in main() in order to ensure that this isn't
just the compiler deferring compilation of the template; the code seems to
work:

-----
import std.stdio;

enum Val : string { a = "a", b = "b" }

void func(Val v1, Val v2)(int num)
{
    writefln("%s + %s -> %s", v1, v2, num);
}

void main()
{
    func!(Val.a, Val.b)(1);
}
-----

(I also fixed a typo writeln -> writefln.)

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