digitalmars.D.bugs - [Issue 6220] New: static foreach over a string[] no longer produces directly usable strings
- d-bugmail puremagic.com (36/36) Jun 28 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6220
- d-bugmail puremagic.com (17/17) Aug 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6220
- d-bugmail puremagic.com (10/10) Aug 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6220
- d-bugmail puremagic.com (12/12) Aug 13 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6220
http://d.puremagic.com/issues/show_bug.cgi?id=6220 Summary: static foreach over a string[] no longer produces directly usable strings Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: regression Priority: P3 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: sandford jhu.edu --- Comment #0 from Rob Jacques <sandford jhu.edu> 2011-06-28 18:43:41 PDT --- In DMD 2.052 and prior one could perform a static foreach over static string arrays, such as those produced by traits. However, in DMD 2.053 one has to 'touch' the string before use. void main(string[] args) { struct Foobar { real x; real y; real z;}; switch("x") { foreach(i,member; __traits(allMembers, Foobar)) { case member : break; // Valid in 2.052 //But in DMD 2.053 this produces an error //Error: case must be a string or an integral constant, not member // Required workaround for DMD 2.053 //case member[] : break; //case member~"" : break; } } } Also, and I'm not sure if this is a regression or not, if used the pointer of member is not valid i.e. you can not use writeln(member);, etc. Although both i and member.length produce correct results. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 28 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6220 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |k.hara.pg gmail.com --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-08-05 15:51:22 PDT --- This is regression of Commit:fc67046cf1e66182d959309fb15ef9e2d4c266b9 . When foreach aggregator is tuple of string literals, the value variable is declared like follows: const member = aggregator[i]; And variable member is not const-folded (WANTvalue). But, before fc67046c, it is interpreted (WANTinterpret), then compile had succeeded. We should declare value variable as manifest constant there for interpretation. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 05 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6220 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, rejects-valid --- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2011-08-05 15:52:53 PDT --- https://github.com/D-Programming-Language/dmd/pull/294 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 05 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6220 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED --- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2011-08-13 12:39:14 PDT --- https://github.com/D-Programming-Language/dmd/commit/60f4ec88decbcd00e765ab392bf8be8f526ed1ab -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 13 2011