← Back to index
|
Original Bugzilla link
Bug 963 – tuples & array literals: Error: non-constant expression ["abc","1"]
Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-02-15T03:44:00Z
Last change time
2014-02-16T15:24:12Z
Assigned to
bugzilla
Creator
thomas-dloop
Comments
Comment #0
by thomas-dloop — 2007-02-15T03:44:22Z
# template A(T ...){ # static assert(2 == T[0].length); # static assert("abc" == T[0][0]); # static assert("1" == T[0][1]); # const A = T[0]; # } # # mixin A!(["abc", "1"]); Strange, all static asserts pass but "const A = T[0];" fails: a.d(8): Error: non-constant expression ["abc","1"]
Comment #1
by bugzilla — 2007-02-18T03:07:23Z
Array literals are currently evaluated at runtime, hence they are not constant expressions.
Comment #2
by bugzilla — 2007-07-01T01:17:14Z
Works with DMD 1.017 and DMD 2.001
Comment #3
by thomas-dloop — 2007-07-23T14:55:47Z
Added to DStress as
http://dstress.kuehne.cn/compile/t/tuple_26_A.d