www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3512] New: dchar iteration over string in CTFE fails

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

           Summary: dchar iteration over string in CTFE fails
           Product: D
           Version: 2.036
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: wbaxter gmail.com


--- Comment #0 from Bill Baxter <wbaxter gmail.com> 2009-11-15 03:17:22 PST ---
Code:
    string s = "ohai";
    foreach (int i, dchar c; s)
    {}


Error:
Error: cannot evaluate _aApplycd2(s,int delegate(ref int __applyArg0, ref dchar
__applyArg1)
{
dchar c2 = __applyArg1;
int i = __applyArg0;
if (cast(uint)c == cast(uint)c2)
__result = i;
return 2;
return 0;
}
) at compile time


foreach(dchar c; s)  also fails similarly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 15 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3512


Jacob Carlborg <doob me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doob me.com


--- Comment #1 from Jacob Carlborg <doob me.com> 2010-01-10 04:14:19 PST ---
This does work for me using dmd 2.037 and later but not using dmd 1.055 on Mac
OS X.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 10 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3512


David Röthlisberger <david rothlis.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david rothlis.net


--- Comment #2 from David Röthlisberger <david rothlis.net> 2010-11-11 11:29:47
PST ---
I'm seeing a similar error. dmd 2.050 on OS X.

Code:
    import std.string;
    void main()
    {
      mixin("int " ~ tolower("A") ~ ";");
    }

Error:

/Users/drothlis/dmd2/osx/bin/../../src/phobos/std/string.d(792): Error:
_aApplycd2 cannot be interpreted at compile time, because it has no available
source code
minimal.d(5): Error: cannot evaluate tolower("A") at compile time

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



--- Comment #3 from David Röthlisberger <david rothlis.net> 2010-11-11 11:33:52
PST ---
(In reply to comment #2)
Whereas the original code posted by Bill Baxter compiles successfully.

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



--- Comment #4 from David Röthlisberger <david rothlis.net> 2010-11-11 11:39:12
PST ---
(In reply to comment #3)
Please ignore comment #3 :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 11 2010