[Issue 2376] CTFE fails on array literal of array literals of chars

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 27 04:57:01 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2376





------- Comment #1 from samukha at voliacable.com  2008-09-27 06:57 -------
This applies to any array of arrays, not only chars. To workaround, initialize
r in foo to []:

string foo(string[] ss)
{
    string r = []; // Interestingly, "" doesn't work.
    r ~= ss[0];
    return r;
}

enum r = foo([['c'], ['d']]);

However, the result of foo is crippled in a way that it cannot be processed
further at compile time.

For example, pragma(msg, r) fails with Error: string expected for message, not
'['c']'

The bug is also present in dmd 1.


-- 



More information about the Digitalmars-d-bugs mailing list