[Issue 5632] New: replace() not evaluatable at compile-time anymore

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 21 08:17:10 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5632

           Summary: replace() not evaluatable at compile-time anymore
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: mrmocool at gmx.de
        Depends on: 4047


--- Comment #0 from Trass3r <mrmocool at gmx.de> 2011-02-21 08:14:29 PST ---
As of 2.052 replace() has moved to std.array and uses Appender. Thus it isn't
evaluatable at compile-time anymore because Appender uses a pointer to a
struct.

import std.array;

int bla()
{
    "aa".replace("aa", "bb");
    return 0;
}

enum blub = bla();


C:\dmd\windows\bin\..\..\src\phobos\std\array.d(1051): Error: Cannot interpret
new Data at compile time
C:\dmd\windows\bin\..\..\src\phobos\std\array.d(1331): Error: cannot evaluate
(Appender!(string) __ctmp1239 = 0; , __ctmp1239).this(array) at compile time
C:\dmd\windows\bin\..\..\src\phobos\std\array.d(884): Error: cannot evaluate
appender(null) at compile time
replacectfe.d(6): Error: cannot evaluate replace("aa","aa","bb") at compile
time
replacectfe.d(10): Error: cannot evaluate bla() at compile time
replacectfe.d(10): Error: cannot evaluate bla() at compile time

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


More information about the Digitalmars-d-bugs mailing list