Thread overview |
---|
July 24, 2007 [Issue 1370] New: Can't const-fold empty array literal | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1370 Summary: Can't const-fold empty array literal Product: D Version: unspecified Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: reiner.pope@gmail.com The following code fails to compile, with error, "non-constant expression 1u ~ []" template GetArray(uint i) { static if (i == 0) const GetArray = 1u ~ GetArray!(i + 1); else const uint[] GetArray = []; } const uint[] array = GetArray!(0); -- |
July 28, 2007 [Issue 1370] Can't const-fold empty array literal | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1370 ------- Comment #1 from samukha@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); -- |
June 13, 2011 [Issue 1370] Can't const-fold empty array literal | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1370 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies@gmail.com Resolution| |FIXED --- Comment #2 from yebblies <yebblies@gmail.com> 2011-06-12 21:40:40 PDT --- This works in current dmd 1.068 and 2.053. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation