Thread overview
[Issue 3512] New: dchar iteration over string in CTFE fails
Nov 15, 2009
Bill Baxter
Jan 10, 2010
Jacob Carlborg
Jul 09, 2011
Johann MacDonagh
Jul 22, 2011
Don
Aug 04, 2011
Walter Bright
November 15, 2009
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: -------
January 10, 2010
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: -------
November 11, 2010
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: -------
November 11, 2010
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: -------
November 11, 2010
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: -------
July 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3512


Johann MacDonagh <johann.macdonagh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johann.macdonagh@gmail.com


--- Comment #5 from Johann MacDonagh <johann.macdonagh@gmail.com> 2011-07-09 06:32:18 PDT ---
This still fails, and will most likely be fixed by issue 6268.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3512


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cbkbbejeap@mailinator.com


--- Comment #6 from Don <clugdbug@yahoo.com.au> 2011-07-22 04:30:24 PDT ---
*** Issue 6268 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 04, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3512


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #7 from Walter Bright <bugzilla@digitalmars.com> 2011-08-03 17:14:29 PDT ---
https://github.com/D-Programming-Language/dmd/commit/9318dc44c3e9aa75907966b9fd122c0cc6700891

https://github.com/D-Programming-Language/dmd/commit/571661646ca420aa4c3fb348e86e35ed8faae624

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