digitalmars.D.bugs - [Issue 2089] New: Issues with CTFE and tuple indexes
- d-bugmail puremagic.com (50/50) May 09 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2089
- d-bugmail puremagic.com (11/11) May 22 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2089
http://d.puremagic.com/issues/show_bug.cgi?id=2089 Summary: Issues with CTFE and tuple indexes Product: D Version: 1.029 Platform: PC OS/Version: Windows Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: samukha voliacable.com ---- template Tuple(A...) { alias A Tuple; } alias Tuple!("one", "two") tuple; size_t foo() { return 1; } static assert(tuple[foo()] == "two"); void main() {} ---- Output: test.d(24): Error: Integer constant expression expected instead of foo() Bogus output when the tuple is indexed in msg pragma (introducing an intermediate const does not help): ---- template Tuple(A...) { alias A Tuple; } alias Tuple!("one", "two") tuple; size_t foo() { return 1; } const i = foo(); pragma(msg, tuple[i]); // fails // static assert(tuple[i] == "two"); // while this passes void main() {} ---- Output: test.d(24): Error: Integer constant expression expected instead of foo() one IIRC, a similar bug was posted long time ago. If anybody can find it, please mark it a duplicate. --
May 09 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2089 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Summary|Issues with CTFE and tuple |Issues with CTFE and tuple |indexes |indexes Fixed dmd 1.030 and 2.014 --
May 22 2008