http://d.puremagic.com/issues/show_bug.cgi?id=7912
Summary: Cannot read compile variable at compile time Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: jaz...@gmail.com --- Comment #0 from Jan <jaz...@gmail.com> 2012-04-14 13:53:23 PDT --- tst.d ---------------------------- import std.stdio; import std.conv; mixin template TTT() { static const uint tst; static this() { tst = 0; } } class T { mixin TTT; } void main() { auto n = 0; switch(n) { case T.tst: writeln("T.tst: ", T.tst); break; default: writeln("default: ", n); break; } } ---------------------------- Run with: > dmd -run tst.d ============================= result: > tst.d(23): Error: variable tst cannot be read at compile time > tst.d(23): Error: variable tst cannot be read at compile time > tst.d(23): Error: case must be a string or an integral constant, not > cast(int)tst ============================= Expected result: > T.tst: 0 ============================= Additional Information: Replace "switch(n)" with "switch(n | (T.tst))" to get expected result. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------