http://d.puremagic.com/issues/show_bug.cgi?id=5048
Summary: string enum type not recognized as a string
Product: D
Version: unspecified
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Jonathan M Davis <[email protected]> 2010-10-12 21:31:00
PDT ---
This program:
import std.stdio;
enum Val : string { a = "a", b = "b" }
void func(Val v1, Val v2)(int num)
{
writeln("%s + %s -> %s", v1, v2, num);
}
void main()
{
}
fails to compile with this error:
prog.d(5): Error: arithmetic/string type expected for value-parameter, not Val
prog.d(5): Error: arithmetic/string type expected for value-parameter, not Val
However, you change Val to string in func's template parameters, then it does
compile. For some reason the compiler is not recognizing Val to be a string
type in func's template parameters. If I make Val an int, it works just fine
(well, make it an int and change the values of a and b to integers), so it
appears to be something to do with strings specifically.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------