[Issue 608] New: Concatenation of const arrays (except strings defined by string literals) is a non-constant expression
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 27 07:26:31 PST 2006
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 at digitalmars.com
ReportedBy: smjg at 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)
----------
--
More information about the Digitalmars-d-bugs
mailing list