November 27, 2006 [Issue 608] New: Concatenation of const arrays (except strings defined by string literals) is a non-constant expression | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=608 Summary: Concatenation of const arrays (except strings defined by string literals) is a non-constant expression Product: D Version: 0.175 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: smjg@iname.com ---------- //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) ---------- -- |
November 29, 2006 [Issue 608] Concatenation of const arrays (except strings defined by string literals) is a non-constant expression | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=608 thomas-dloop@kuehne.cn changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE ------- Comment #1 from thomas-dloop@kuehne.cn 2006-11-29 15:31 ------- *** This bug has been marked as a duplicate of 595 *** -- |
Copyright © 1999-2021 by the D Language Foundation