May 09, 2008 [Issue 2089] New: Issues with CTFE and tuple indexes | ||||
---|---|---|---|---|
| ||||
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 22, 2008 [Issue 2089] Issues with CTFE and tuple indexes | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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 ------- Comment #1 from bugzilla@digitalmars.com 2008-05-22 05:06 ------- Fixed dmd 1.030 and 2.014 -- |
Copyright © 1999-2021 by the D Language Foundation