[Issue 1370] Can't const-fold empty array literal
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jul 28 03:31:34 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1370
------- Comment #1 from samukha at voliacable.com 2007-07-28 05:31 -------
There is a workaround, if it's of any use.
template GetArray(uint i)
{
static if (i == 0)
const GetArray = ([1u] ~ GetArray!(i + 1));
else
const uint[] GetArray = [];
}
const uint[] array = GetArray!(0);
----------
One more test case. Fails with error "semicolon expected following auto
declaration, not '~'".
template GetArray(uint i)
{
static if (i == 0)
const GetArray = [1u] ~ GetArray!(i + 1); //fails
else
const uint[] GetArray = [];
}
const uint[] array = GetArray!(0);
--
More information about the Digitalmars-d-bugs
mailing list