Bug 1015 – Compile-time functions cannot return multidimensional array literals

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-03-01T18:54:00Z
Last change time
2014-02-16T15:25:23Z
Assigned to
bugzilla
Creator
tknott

Comments

Comment #0 by tknott — 2007-03-01T18:54:12Z
See title. I'm not sure if this is a bug or not (the spec doesn't specify anything related to compile-time handing of multidimensional arrays), but compile-time handling of multidimensional arrays (necessary for arrays of strings) seems broken right now. More specific error messages or more runtime-like handling, as well as a clarification in the spec, would be much better. This bug is probably also related to bug 995 (if not a duplicate, though I think this issue is different enough to warrant a new bug report considering it has a different error message). Here's a test case: char[][] func() { return [""]; //Line 3 } char[][] foo = func(); //test.d(3): Error: non-constant expression [""]
Comment #1 by clugdbug — 2007-09-13T07:16:00Z
This works in DMD 1.020. It was probably a duplicate of bug 995.