www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 608] New: Concatenation of const arrays (except strings defined by string literals) is a non-constant expression

reply d-bugmail puremagic.com writes:
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)
----------


-- 
Nov 27 2006
parent d-bugmail puremagic.com writes:
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 ***


-- 
Nov 29 2006