Thread overview |
---|
September 27, 2008 [Issue 2376] New: CTFE fails on array literal of array literals of chars | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2376 Summary: CTFE fails on array literal of array literals of chars Product: D Version: 2.019 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: samukha@voliacable.com string foo(string[] ss) { string r; r ~= ss[0]; // problem here return r; } enum r = foo([['c'], ['d']]); ---- cannot evaluate foo([['c'],['d']]) at compile time -- |
September 27, 2008 [Issue 2376] CTFE fails on array literal of array literals of chars | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2376 ------- Comment #1 from samukha@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. -- |
September 27, 2008 [Issue 2376] CTFE fails on array literal of array literals of chars | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2376 ------- Comment #2 from matti.niemenmaa+dbugzilla@iki.fi 2008-09-27 11:11 ------- This one's probably related to, if not a duplicate of, Issue 1059. -- |
October 04, 2008 [Issue 2376] CTFE fails on array literal of array literals of chars | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2376 ------- Comment #3 from bugzilla@digitalmars.com 2008-10-04 01:31 ------- Please file pragma(msg, ['c']) as a separate report. -- |
October 04, 2008 [Issue 2376] CTFE fails on array literal of array literals of chars | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2376 ------- Comment #4 from samukha@voliacable.com 2008-10-04 03:30 ------- done. http://d.puremagic.com/issues/show_bug.cgi?id=2391 -- |
October 21, 2008 [Issue 2376] CTFE fails on array literal of array literals of chars | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2376 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #5 from bugzilla@digitalmars.com 2008-10-20 22:19 ------- Fixed dmd 1.036 and 2.020 -- |
Copyright © 1999-2021 by the D Language Foundation