www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4448] New: labeled break doesn't work in CTFE

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4448

           Summary: labeled break doesn't work in CTFE
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: shro8822 vandals.uidaho.edu


--- Comment #0 from BCS <shro8822 vandals.uidaho.edu> 2010-07-11 15:12:45 PDT
---
string CTFE(string s) {
  int i, j;
  L1: for(i = 0; i < s.length; i++)
    switch(s[i]) {
      case ' ', '\n', '\r', '\t':
        continue;
      default: break L1;
    }
  L2: for(j = s.length; j > i; j--)
    switch(s[j-1]) {
      case ' ', '\n', '\r', '\t':
        continue;
      default: break L2;
    }
  return s[i..j];
}

import std.stdio;
pragma(msg, CTFE(" hello world!\n"));
void main(){ writef("'%s'\n", CTFE(" hello world!\n")); }

the function works at runtime but fails under CTFE. There may be a few cases
where labeled break may be hard to deal with but this one shouldn't cause
problems.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 11 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4448


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED


--- Comment #1 from Don <clugdbug yahoo.com.au> 2011-06-23 00:31:51 PDT ---
https://github.com/D-Programming-Language/dmd/commit/f7904df0868ba2996785a9812df66991b124e0d6

Labelled continue is added here:
https://github.com/D-Programming-Language/dmd/commit/897202a6178cce17c75512a9ca9a0230b31255cf

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 23 2011