← Back to index
|
Original Bugzilla link
Bug 608 – Concatenation of const arrays (except strings defined by string literals) is a non-constant expression
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-11-27T09:26:00Z
Last change time
2014-02-15T13:21:29Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
smjg
Comments
Comment #0
by smjg — 2006-11-27T09:26:30Z
---------- //const char[] qwert = "yuiop"; const char[] qwert = [ 'y', 'u', 'i', 'o', 'p' ]; //const char[] qwert = [ 121, 117, 105, 111, 112 ]; const char[] asdfg = qwert; const char[] hjkl = "" ~ qwert; const char[] zxcvb = qwert ~ ""; const char[] nm = qwert ~ asdfg; ---------- const_init_array_1.d(5): Error: non-constant expression "" ~ (qwert) const_init_array_1.d(6): Error: non-constant expression (qwert) ~ "" const_init_array_1.d(7): Error: non-constant expression (qwert) ~ (qwert) ---------- The same happens if line 3 is used instead of line 2. If line 1 is used, the code compiles without error. Using null instead of "" makes no difference. Similarly: ---------- const int[] qwert = [ 121, 117, 105, 111, 112 ]; const int[] asdfg = qwert; const int[] hjkl = null ~ qwert; const int[] zxvcb = qwert ~ null; const int[] nm = qwert ~ asdfg; ---------- const_init_array_2.d(3): Error: non-constant expression null ~ (qwert) const_init_array_2.d(4): Error: non-constant expression (qwert) ~ null const_init_array_2.d(5): Error: non-constant expression (qwert) ~ (qwert) ----------
Comment #1
by thomas-dloop — 2006-11-29T15:31:16Z
*** This bug has been marked as a duplicate of 595 ***